GoogleHomeã§ãã½ã³ã³èµ·åããããã¤ã§ã pic.twitter.com/AQf0OOzdKd
— å «éè (@happou31) 2018å¹´3æ6æ¥
æã家ã«ãGoogle Home miniãæ¥ãã®ã§ãè²ã éãã§ã¿ã¾ããã ãã£ããããããä»çµã¿ã§ãâ
1. ãã½ã³ã³ã®é»æºãã¿ã³ã«è§¦ããã«ãã½ã³ã³ãèµ·åããã«ã¯ï¼
Wake On LAN ã¨ããä»çµã¿ã使ãã¾ãã
æã家ã®PCã¯ãã¶ã¼ãã¼ãã対å¿æ¸ã¿ã®ãã®ã ã£ãã®ã§ãããã使ããã¨ã«ãã¾ãã
ãã¡ã¯ã«ã¼ã¿ã¼ãå¤ããã®ãã±ãããããã¼ããã£ã¹ããã¦ãããªãã¿ããã§ãç´æ¥WOLã®ãã¸ãã¯ãã±ãããéä¿¡ããã®ã¯ä¸å¯è½ã ã£ãã®ã§ãLANå
ã«ã¦ã§ããµã¼ãã¼ãç«ã¦ã¦ãããã¤ã«å¯¾ãã¦ãªã¯ã¨ã¹ããéä¿¡ãããã¨ã§éæ¥çã«éã£ã¦ããããã¨ããä»çµã¿ã«ãããã¨ã«ãã¾ããã
2. GoogleHomeããHTTPãªã¯ã¨ã¹ããéä¿¡ããã«ã¯ï¼
IFTTT ã¨ããã¦ã§ããµã¼ãã¹ã使ãã¾ãã
IFTTTã¯ãã¦ã§ããä»ããããããªã¢ã¯ã·ã§ã³ãããªã¬ã¼ã¨ãã¦ãããããªã¢ã¯ã·ã§ã³ãèµ·ããã¦ãããã¦ã§ããµã¼ãã¹ã§ãã
ããããªã£ã¦ãªãããããã¨æãããããã¾ããããæ¬å½ã«è²ã
åºæ¥ãã®ã§ã¨ã¦ã便å©ã§ãããAmazonããã¡ã¼ã«ãæ¥ããTwitterã§èªåã«ãªãã©ã¤ãéããã¨ãã£ãåä½ãä¸è¡ãã³ã¼ããæ¸ããã«å®ç¾åºæ¥ãã®ã§å¤§å¤ãæ軽ã
ã§ãIFTTTã¯ãOk, Googleãã§ã馴æã¿Google Assistantã¨ãé£æºã§ããã®ã§ãããGoogle Homeã¯åºæ¬çã«ãã®Google Assistantãä»ãã¦åãçãããã¦ãã¾ãã
ã¤ã¾ããGoogle Homeã使ãã°Google Assistantãä»ãã¦IFTTTã«ããªã¬ã¼ãéä¿¡ããäºãã§ããã¨ãããã¨ã§ãï¼ï¼ï¼
次ã«ä½ãã¢ã¯ã·ã§ã³ã«ããã®ãã¨ããã¨ããã°ããWebhookãã使ãã¾ãã
ããã¯ãã¢ã¯ã·ã§ã³ããã£ããã«ãæå®ããURLã«æå®ããHTTPãªã¯ã¨ã¹ããéä¿¡ãããã¨ãããã®ã§ããã¤ã¾ãããããæ¾é¡ã§ãã
ã¾ã¨ããã¨ãGoogle Assistantã®ç¹å®ã®ãã¼ã¯ã¼ããããªã¬ã¼ã«ãæå®ããURLã«HTTPãªã¯ã¨ã¹ããéä¿¡ãããã¨ããã¢ã¯ã·ã§ã³ãè¨å®ãããã¨ãããã¨ã«ãªãã¾ãã
3. ãªã¯ã¨ã¹ããã©ããã£ã¦åããï¼
ã¦ã§ããµã¼ãã¼ã§ããã°ãªãã§ãããã®ã§ããããã½ã³ã³ãèµ·åãããã¨ãããã¨ã¯ã¡ã¤ã³ã®ãã½ã³ã³ã¯å½ç¶ä½¿ããªãã®ã§ãå¥ã«ãµã¼ãã¼ç¨ãã½ã³ã³ãå¿
è¦ã¨ãããã¨ã«ãªãã¾ãã
ä»åã¯ã©ãã®ã家åºã«ããã Raspberry Pi 3 ã使ãã¾ãããã©ãºãã¤ã§ããã°ã常æèµ·åãã¦ãã¦ãé»æ°ä»£ã«åªãããã§ãã
ã©ãºãã¤ä¸ã«HTTPãµã¼ãã¼ãç«ã¦ãæé ã¯å²æãã¾ãããããã§ä¸ã¤æ³¨æãããã®ã¯ãå¤ããã®éä¿¡ãä¸ç¶ããã¨ãããã¨ã¯ ãå¤ãã家ã®ãã½ã³ã³ã®é»æºãONã«åºæ¥ãç¶æ
ã«ãªãã ã¨ãããã¨ã§ãã
é»æºãONã«ãããç¨åº¦ã¨è¨ã£ã¦ãã¾ãã°ããã§ããããã¯ãåæã«ä½ãããããããããã®ã¯ã¨ã¦ãå°ãã®ã§ãã»ãã¥ãªãã£å¯¾çã¯ãã£ããã¨ãã¦ããã¾ãããã
HTTPãµã¼ãã¼ãç«ã¦ããã¼ãã80çªä»¥å¤ã«ããããGETãªã¯ã¨ã¹ãã§ã¯ãªãPOSTãªã¯ã¨ã¹ãã§åããããã«ããããBASICèªè¨¼ãæããããIFTTT以å¤ããã®éä¿¡ã¯æå¦ãããâ¦ãªã©ãåããããªå¯¾çã¯ä½éããããã¾ããåºæ¥ãéãçµã¿åããããã¨ã§ã»ãã¥ãªãã£ã¯é«ãã¦ããã¾ããããHTTPSãè¨å®ãã¦ããã¨ã ãã¶å®å¿ã ã¨æãã¾ãã
å人çã«ãã®æé ãä¸çªåä»ã§ãLinuxã®ç¥èãä¸éå端ã«ãããªãåã¯è²ã è¦å´ãã¾ããã
- Wake On LAN ãéä¿¡ããã³ãã³ã
ether-wake
ã管çè 権éã§ããåä½ããªãã®ã§ãsudoersãã¡ããã£ã¨ããã£ãã - ãã§ã«HTTPãµã¼ãã¼ãç«ã¦ã¦ããç¶æ ã ã£ãã®ã§ãVIrtualHostã使ã£ã¦ãã¼ãã§èªã¿åããã£ã¬ã¯ããªãåãæ¿ããããã«ããããhttpd.confã®è¨è¿°ä¸è¶³ãããã£ã¬ã¯ããªã®ãã¼ããã·ã§ã³è¨å®ãééãã¦ãã¦403ãè¿ã£ã¦ããã
- HTTPSãå°å ¥ãããã¨Let's Encryptã®è¨å®ã¹ã¯ãªããã使ããã¨æã£ãããã¤ã³ã¹ãã¼ã«ããã¦ããOSã32bitãªããã§åä½å¯¾è±¡å¤ã ã£ãã
ã¤ã³ãã©å±ããã¯ããããªãã»ã»ã»
çµããã«
ã¾ãããããªæãã§ãæã家ã«ãå°ããã¤IoTã®é¢¨ãå¹ãã¦ãã¾ããã
Google Assistant + IFTTT + Raspberry Pi ã®çµã¿åããã¯ç¡éã«é¢ç½ããã¨ãåºæ¥ãããªã®ã§ãä½ãé¢ç½ãç©ãã§ãããã¾ãè¨äºãæ¸ããã¨æãã¾ãã
ããã§ã¯ã¾ãã