Closed schauveau closed 6 months ago
Could you make a pull request for this?
I am working on a PR but I may not be able to pass the tests on my raspberry Pi 2 . The last time I tried, the processes were killed before the end.
Just submit the PR, the pipeline will run the tests
This is now available in zigbee2mqtt master with the following features:
update_frequency
can now be set between 3 and 60 secondsenergy_flow
Unfortunately, the Home Assistant integration cannot be improved from within the converter (see https://github.com/Koenkk/zigbee2mqtt/issues/22098 ) so I have the following in my zigbee2mqtt/data/configuration.yaml
to have HA recognize timestamp_a
and timestamp_b
as proper timestamp instead of strings.
devices:
'0xa4c138078e510fdc':
...
homeassistant:
timestamp_a:
icon: mdi:clock
device_class: timestamp
entity_category: diagnostic
enabled_by_default: false
timestamp_b:
icon: mdi:clock
device_class: timestamp
entity_category: diagnostic
enabled_by_default: false
@schauveau, are you able to assist with #24259? I think it's the same meter as PJ-1203A but with different datapointids. I'm not sure how to adapt the code in tuya.ts into a .js to test if your improvements work on this device.
Is your feature request related to a problem? Please describe
The PJ-1203A is a Bidirectional dual channel energy meter. The current converter suffers from a few issues ; the most annoying one being that the energy flow direction is reported during the next update. This is highly problematic because that means that incoherent data is published when the direction changes.
For example, suppose that solar panels are producing an excess of 100W on channel X and that a device that consumes 500W is turned on. The following states will be published by Z2M:
So during a full update cycle (10s by default), the device is seen as producing 400W which is absolutely wrong.
Describe the solution you'd like
Using the information provided in https://github.com/Koenkk/zigbee2mqtt/issues/18419 , I have been working on an improved external converter that caches the channels datapoints and emit them together once a full and hopefully coherent set is collected.
So the new features are:
energy_flow_x = consuming|producing
).timestamp_a|b
to indicate whenpower_a|b
was received.Describe alternatives you've considered
Additional context
Home Assistant auto-discovery is incomplete for PJ-1203A because most attributes suffixed with a channel name (e.g.
power_a
,current_a
, ... ) are not properly handled. This is true for both my converter and the current one in Z2M.So my
configuration.yaml
contains the following entries. The timestamp entries are required to have HA recognizetimestamp_a
andtimestamp_b
as proper timestamps.