OpenBK7231T_App
OpenBK7231T_App copied to clipboard
Emetering refactoring
-
Added SaveState and PublishHASSDevices driver callbacks
This allows implement other [metering] drivers which will use these callbacks.
-
Allow drivers to have different set of EnergySensors.
Multiple drivers might implement different set of EnergySensors, and we need a way to publish it into HASS. Instead of DRV_GetEnergySensorNames() use in hass_init_energy_sensor_device_info(), we could pass sensor structure directly. Function DRV_GetEnergySensorNames() removed completely.
-
Reimplement DRV_GetReading()
Multiple drivers might be used to get same Reading. We need a way to get value from currently used active driver. Solution: Driver should keep its 'readings' values in global array.
Enum
reading_e
and appropriate global array are introduced for DRV_GetReading().Enum
energySensor_e
is local fordrv_bl_shared
-based drivers. Please don't get confused. :)Enum
energySensor_e
(local to drivers) might be subset ofreading_e
, and also could contain sensors, not available as Readings. Other Drivers could be designed completely withoutenergySensor_e
-like enums.
I implemented 3phase power meter hass integration using BL602, and want to publish all related code changes and my proposals. This is patch series, which I prepared for publishing from "dirty hacks I already done".
My 3phase power meter module code is dirty and build with BL602 specific. For those interested, I published that code in my repo (https://github.com/openshwprojects/OpenBK7231T_App/commit/3842a4458a4433d75462ed255a126b841fddce57).
Kindly ask maintainers to comment changes in overall. Thanks.