Orvibo WiWo S20
I bought this WiWo-S20 wifi switch a little while ago at Banggood because it was cheap (payed around €17) and it’s always handy to have remote controlled switches in the house.
Usage
The switch comes with an app to control it (and yes, there is also an Android app). Besides toggling the power from the app, it’s also possible to configure a countdown timer, or specify a schedule. This alone is worth the purchase. In the past i used a number of time switches, but changing the settings was always a burden. Now with the app it’s intuitive and simple.
Control
The plan was always to control this switch from my domotica system (i use Domoticz) so that it can be tied to events (for instance me waking up and automagically switching on the coffee). Luckily the heavy lifting (i.e. reverse engineering) has already be done, and somebody even wrote a perl script which i will be using with domoticz.
Normally these kind of devices are controlled via TCP/IP, so in a connection oriented way (establish the connection, give commands en quit). But this devices works connectionless through UDP. By using netcat we can still control the device from the commandline:
## Subscribe to the device:
echo '6864001e636c'"accf532147e4"'202020202020'"e4472153cfac"'202020202020' | xxd -r -p | nc -u -w2 -p10000 192.168.1.76 10000 | xxd -p
## Switching on:
echo '686400176463'"accf532147e4"'2020202020200000000001' | xxd -r -p | nc -u -w2 -p10000 192.168.1.76 10000 | xxd -p
## Switching off:
echo '686400176463'"accf532147e4"'2020202020200000000000' | xxd -r -p | nc -u -w2 -p10000 192.168.1.76 10000 | xxd -p
The accf532147e4
in there is the MAC address of the device.You first need to subscribe to the device and then give the command to switch on or off.
With the perl code it’s of course much easier; subscribing is already taken care of in the script, so it’s:
$ ./orvibo-s20.pl AC:CF:23:51:47:E4 status
off
$ ./orvibo-s20.pl AC:CF:23:51:47:E4 on
$ ./orvibo-s20.pl AC:CF:23:51:47:E4 status
on
$ ./orvibo-s20.pl AC:CF:23:51:47:E4 off
When you download the script from github, it’s called bauhn, but i renamed it to a name that makes more sense to me.
Domoticz
Controlling the switch from domoticz is not very complex. First you need to get the perl script into the domoticz/scripts directory.
Next open the Domoticz web GUI, go to Setup -> Hardware and add a new Dummy device.
Go to Setup -> Devices and enable the device (click on the green arrow next to the name you gave it, and it should become a blue arrow).
The new dummy switch can be found in switches, click on edit and now you can configure the on and off actions:
That’s all there is to it. Have fun!
Sources: