howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Sonoff POW R2 #13

Open luizjunior opened 5 years ago

luizjunior commented 5 years ago

Hi, FIRST OF ALL: thanks for this implementation... no need for firmware replacement... VERY NICE!

Second, how can I help to add support for Sonoff POW R2?

I'd like to read the consumption data on the Home app.

Also, how about create a wiki with curl commands from the API so we can map all RAW data and protocol from sonoff devices?

howanghk commented 5 years ago

Hi @luizjunior, it would be great if you can help on adding support for the Sonoff POW R2! This project is open source and have a relaxed license that you are free to modify the code and share your work. You can look into the source code, it's written in Javascript which is fairly easy to understand and write. To contribute code back to this project, please fork the repository, make the necessary changes and then send me a pull request.

To intercept the API request / response data, please refer to the README on the original homebridge-ewelink project, which have a section showing how to observe the data with Charles.

ZeppDK commented 5 years ago

anyone gotten the POW R2 to work? i can see that homebridge gets the info about power in the log

[5/11/2019, 1:32:20 PM] [eWeLink] Error updating non-exist accessory with deviceId [XXXXXXX]. [5/11/2019, 1:34:20 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"XXXXXXX","apikey":"XXXXXXXXXXXXXXXX","userAgent":"device","ts":0,"params":{"power":"7.28","voltage":"235.56","switch":"on"},"from":"device"}

micheljansen commented 3 years ago

+1 for this feature. The most elegant solution would be to have power consumption in Watt as a sensor value, but looking at the full list of Apple HomeKit Characteristic Types (https://developer.apple.com/documentation/homekit/hmcharacteristic/characteristic_types), it seems that no "power consumption" characteristic exists yet. There are temperature, humidity, motion and various "on/off" states, but none seem suitable for power consumption.

For my use case (seeing if the washing machine is still running or has finished), it would already be a big step forward if I could show something like an "Outlet in Use" status for the device when power consumption is above a certain threshold. That way I can set up automations in the Apple Home App to notify me when the laundry is ready.

I can also see the power level coming in as events in the log, but not sure how to go about adding new characteristics to the switch in the plugin. Any thoughts?