Closed elektrinis closed 1 year ago
It could be done to set up a template to set the Meter active Power to Zero if it's got an unreasonably high value (for example if it's over 30kw.)
for me it looks like expected behaviour:
The meter is connected between grid and house wires and is powered by one 'incoming' phase from the grid.
If the grid is off, the meter does not have power. All RS485 read/write requests will return 0xFFFF FFFF. This raw value is interpreted as a signed integer, so 0x7FFF FFFF (2 147 483 647 decimal)
We could use a template sensor to check the raw value for 0x 7FFF FFFF and set the sensor to "unavailable".
It is somehow easily testable: Just switch off your circuit breakers and have a look .
It should be just 4 sensors, right? Total power and phase A-C power.
Yes I think template for this value would be the correct way to go. I'm just not sure if it should be "unavailable", or just zero. In case of blackout, zero would be closer to reality.
Yes I think it's needed for 4 sensors.
I do not use the package in the form as here in the repository. I have split it into modbus, template and helper. So I don't have to restart HA with every change.
And unfortunately not so fit with GitHub and pull requests yet. But here is my change to the sensors:
_raw
to the name.- name: sg_meter_active_power
unique_id: 20737f1c-544e-4daf-8fcb-282462c4e28a
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ states('sensor.sg_meter_active_power_raw') | float(0) }}"
availability: "{{ states('sensor.sg_meter_active_power_raw') | int(0) != 0x7FFFFF }}"
Sensor is unavailable
in case of black-out. I think that is the best state for that case.
done in dabc6ec27d4b34e00458998232f03732f5523786
thank you for the hint with the "availability" parameter. I adapted all templates to this and readability got improved :)
And unfortunately not so fit with GitHub and pull requests yet. But here is my change to the sensors:
I am still learning all this, too (svn is enough at work for my things...). Just give it a try next time - I won't bite, if something goes wrong! ;)
Had a blackout today, home was running on battery.
Got
meter active power
(and also all meter phases) values equal to 2^31.Meter was powered off and was inaccessible via RS485. Perhaps a workaround is needed?