drc38 / DiUS_Powersensor

Home Assistant Custom Integration for DiUS Powersensors
MIT License
9 stars 0 forks source link

Support for multiple sensors #227

Open s-01010011 opened 1 year ago

s-01010011 commented 1 year ago

Is your feature request related to a problem? Please describe. I have two Power Sensors, one for solar generation and the other for total consumption. The integration seems to show both sensors in HomeAssistant as one sensor with the value oscillating between both sensor values continuously when I check the value against the phone app in real time which makes the output not that useful.

Describe the solution you'd like Could the integration be modified to see the two sensors as different devices based on the Mac addresses and listed in HomeAssistant as two different devices so the values can be used separately?

Describe alternatives you've considered I don't know enough to be able to suggest any code changes.

Additional context Power Sensor kit with the single plug and two sensors, one for solar generation wrapped around the AC from Solar Inverter and the other attached in the meter box as per typical single sensor installation. Both sensors seem to have unique Mac addresses when I look at the devices in the app. I am not sure why the solar generation is currently showing a -neg value (it's rainy today so won't be generating much) so could be parasitic draw from grid to keep Inverter powered from mains. Slight differences in the values displayed due to timing for the screenshots.

Screenshot 2023-05-23 at 3 16 19 pm Screenshot 2023-05-23 at 3 15 18 pm

IMG_3638

s-01010011 commented 1 year ago

Sorry didn't notice the "add multiple sensors" on the TODO at the top of the readme. Please feel free to close this if it's already a known issue/planned work.

Here's some output from the HA debug log if it's helpful for future development.

2023-05-23 15:43:29.339 DEBUG (MainThread) [custom_components.dius] Received message json: {'mac': 'xxxxxxxxxxx98', 'device': 'plug', 'count': 13, 'summation': 870297.8916346187, 'duration': 1.043084, 'starttime': 1684827782.12031, 'voltage': 241.16953998301784, 'power': 0.01750727790054708, 'reactive_current': 0.0001273792983164376, 'type': 'instant_power', 'current': 0.09901780762590465, 'unit': 'W', 'source': 'BLE', 'active_current': 0.00010582280167827124}

2023-05-23 15:43:29.841 DEBUG (MainThread) [custom_components.dius] Received message json: {'mac': 'xxxxxxxxx67', 'device': 'sensor', 'summation': 2140102151, 'duration': 1, 'type': 'instant_power', 'batteryMicrovolt': 3831776, 'unit': 'w', 'starttime': 1684827782, 'power': -33}

2023-05-23 15:43:30.344 DEBUG (MainThread) [custom_components.dius] Received message json: {'mac': 'xxxxxxxxx66', 'device': 'sensor', 'summation': 25011500, 'duration': 1, 'type': 'instant_power', 'batteryMicrovolt': 3889120, 'unit': 'w', 'starttime': 1684827782, 'power': 520}