esp-homekit-demo icon indicating copy to clipboard operation
esp-homekit-demo copied to clipboard

Sonoff power and library HLW8012

Open oremic opened this issue 5 years ago • 11 comments

hi. There are ways to have the HLW8012 library to get the EVE power meter via apple homekit. for th10 and th16 thank you

oremic avatar Feb 28 '19 11:02 oremic

Ok, I guess this is a question, not a statement and it's about supporting power measurement on some Sonoff models (a good writeup by author of HLW8012 library for ESP8266 on ArduinoCore). Although I couldn't find evidence that HLW8012 is installed on Sonoff TH10/TH16 models.

I checked the library and I think it can be easily ported to esp-open-rtos: you just need to replace digitalWrite() and always use interrupts instead of doing busy waiting counting pulse width in pulseIn() function.

As of Elgato EVE support for exposing that data, here is reverse engineered list of EVE custom characteristics.

maximkulkin avatar Feb 28 '19 18:02 maximkulkin

Hello There was a question. It would be really nice to have consumption, for sonoffs. Eve allows to have a series of information on consumption. I could test it if you can make a port. thank you.

oremic avatar Feb 28 '19 19:02 oremic

Hi @maximkulkin,

Many devices now have integrated this power meter. In example, the cost effective Houzetek AW7PL has the HWL8012 and the device is apparently great, as has several GPIOS free to add it aditional functionalities.

Would be possible to integrate it?

Many thanks!

seritos avatar Sep 04 '19 22:09 seritos

@maximkulkin I'm also interested in HWL8012 library for esp-open-rtos 😄

Also keep in mind that HWL8012 needs to be calibrated for proper measurements. 😄

HomeKidd avatar Nov 29 '19 07:11 HomeKidd

As Maximkulkin said, this library will be easily modified. The question is, did anyone manage to create custom features? @Maximkulkin would you build these features for us users?

Kristian8606 avatar Apr 10 '20 07:04 Kristian8606

Yes, i have but without the Eve characteristics and HomeKit data type it will not work. HomeKit data type is added to esp-homekit, but its not that easy to work with like an int/float based characteristic like Temp Sensor etc.😄 But i'm still working on it 😄

HomeKidd avatar Apr 10 '20 07:04 HomeKidd

Can you share the code? I think maximkulkin added the data type.

Kristian8606 avatar Apr 10 '20 08:04 Kristian8606

HLW8012_BL0937_ESP-master.zip As i've said, data type is added because i've requested it but currently on static data is working. But its way more complicated since other types......i'm working on this since december

HomeKidd avatar Apr 10 '20 08:04 HomeKidd

In another post you mentioned that you were able to show the story, can you share code?

Kristian8606 avatar Apr 10 '20 08:04 Kristian8606

In another post you mentioned that you were able to show the story, can you share code?

I was not able to show any history with esp-homekit, only with HomeKit Accessory Simulator and only one time. So theres no code currently!

HomeKidd avatar Apr 10 '20 08:04 HomeKidd

I already did a port.. it's here:- https://github.com/maccoylton/HLW8012_BL0937_ESP Example of a device using it it here:- https://github.com/maccoylton/esp-homekit-gosund-up111

Feedback welcome

maccoylton avatar Apr 11 '20 15:04 maccoylton