Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sonoff smart plugs #31

Open
rodneymo opened this issue Jun 3, 2018 · 3 comments
Open

Add support for sonoff smart plugs #31

rodneymo opened this issue Jun 3, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@rodneymo
Copy link
Owner

rodneymo commented Jun 3, 2018

No description provided.

@rodneymo rodneymo added the enhancement New feature or request label Jun 3, 2018
@evlo
Copy link

evlo commented Jul 29, 2018

Official API http://iotgo.iteadstudio.com/api

Tasmota Web "API"
http://192.168.500.400/cm?cmnd=Power%20On
returns json
{"POWER":"ON"}

/cm?cmnd=Power%20Off
{"POWER":"OFF"}

/cm?cmnd=Power%20TOGGLE
{"POWER":"OFF"}
{"POWER":"ON"}
that is state after toggle

/cm?cmnd=Status%208
{"StatusSNS":{"Time":"2018-07-26T22:34:08","ENERGY":{"Total":0.000,"Yesterday":0.000,"Today":0.000,"Power":10,"Factor":0.52,"Voltage":236,"Current":0.083}}}
10W

/cm?cmnd=status
{"Status":{"Module":43,"FriendlyName":["Sonoff"],"Topic":"sonoff","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}
"Power":1=On
"Power":0=Off

tasmota also supports https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview, I used it with home assistant with success, but I think web would be easier, as it does not require broker like mqtt, I will try to do .py that woks same as tplink.py if I find time for it. I will try to do it for tasmota, but no guaranties :) - it would be my first python script.

@evlo
Copy link

evlo commented Jul 30, 2018

So I tried to modify tplink.py to return fake
'{"emeter":{"get_realtime":{"current":%c%,"voltage":%v%,"power":%p%,"total":0,"err_code":0}}}'
Obviously with replaced tokens, but I guess you don't really call tplink.py from your script, but handle everyhting internally or maybe you do call some commands before {"emeter":{"get_realtime":{}}} which I also should fake output ? I'm to lazy to sniff the traffic right now :)

@rodneymo
Copy link
Owner Author

I have been playing with this for a few days and reverse engineering the standard cloud API is a lot of work, especially with the latest versions of the product firmware so now I am going to give Tasmota a try. The other advantage of Tasmota, as I see it, is the fact that the API provide power measurements as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants