Используем Amazon Dash Button в своих целях



amazon - .

amazon dash button nodejs.


IoT, - amazon, , - .
, . — , / . .
« » slack , .
,
, . , .


?
0. «» wi-fi , , amazon .

1. :
1.1 wi-fi , amazon.
1.2 .. .

2. C, , wi-fi , mac- .
2.1 .
slack

.

?
, geektimes , iot-buttons .

amazon 5$ ( prime).

. , 10.







«Amazon Elements» :)
wi-fi , .
, ~1000 . , , .


«» .
— mac- wi-fi ARP .

parker-gateway-na.amazon.com .

wifi-
amazon -> .

. , .



«» NodeJs
.
:
  • linux, ( ).
  • libpcap-dev.
  • .
  • wi-fi , .


npm install node-dash-button

npm node-gyp
sudo npm install -g npm
sudo npm install -g node-gyp

- :
sudo node node_modules/node-dash-button/bin/findbutton 

.

:
sniffer = require('node-dash-button');

// mac-    
buttons = {
	'8f:3f:20:33:54:44':{
		action: function(){
			console.log('Press button 1')
		}
	},
	
	'2e:3f:20:33:54:22': {
		action: function(){
			console.log('Press button 2')
		}
	}
	// ...
};

//  
// Object.keys(buttons) -  mac-  
sniffer( Object.keys(buttons) ).on("detected", function (catched_mac){
	console.log(' mac-: '+catched_mac+'\n');

	//    
	buttons[catched_mac].action(); 
});

.. mac , — .

, .

UPD: .
, , - .

:
  • « », , email .
  • « » — email .


:
  • « », , email/ wunderlist.
    :) , , , , ..

API.

:
  • .
    . , .
  • -. - wifi- .
    7:00 9:00 - - . 9:00 13:00 . C 13:00 15:00 , 15:00 18:00 -, 18:00-21:00 . .
    - IT-.


.

Source: https://habr.com/ru/post/zh-CN388955/


All Articles