UNPKG

pimote

Version:

Control Energenie Switches from a Raspberry Pi

89 lines (56 loc) 1.61 kB
[node-energenie-pimote]: https://www.npmjs.com/package/node-energenie-pimote [Github]: https://github.com/CliffS/pimote/issues # pimote Control Energinie Switches from a Raspberry Pi This module is based on [node-energenie-pimote] but it is structured as a class. Also the pins are set up and dropped each time. The original module has the problem that it stops working if the cli version is used while a long-term program is running. ## Installation ### For the pimote CLI npm install -g pimote ### For use as a module npm install pimote ## Command Line Interface [CLI] ### Pairing a socket 1. Press and hold the button on the socket until the light begins to flash quickly 2. Run `pimote pair N` where `N` is the device number 1 to 4. ### Switching on or off a socket * To switch on a socket run `pimote on N` where N is 1 to 4. * To switch off a socket run `pimote off N` where N is 1 to 4. ### Switching on or off all sockets * To switch on all four sockets, run `pimote on` * To switch off all four sockets, run `pimote off` ## Usage as a module Note that the module is defined as a static class. You should not try to run `new` on it. ```javascript const Pimote = require('pimote'); ``` ### Methods Switch number 1 on ```javascript Pimote.switchOn(1); ``` Switch number 2 off ```javascript Pimote.switchOff(2); ``` Switch all devices on ```javascript Pimote.switchOn() ``` Switch all devices off ```javascript Pimote.switchOff() ``` Pair device 4 ```javascript Pimote.pair(4); ``` ## Author Cliff Stanford ## Issues Please open an issue on [Github].