domoticz / domoticz

Open source Home Automation System
http://www.domoticz.com
GNU General Public License v3.0
3.49k stars 1.13k forks source link

Allow Float on MQTT Gas meter #6186

Closed herm42 closed 3 days ago

herm42 commented 2 weeks ago

In have a zwave gasmeter in my setup which is included to domoticz since years. There is only a small bug ... if you look at the device ...

image

and on the utility page ... image

image

you can see that the m³ value is truncated ... is there a way to allow float here?

gizmocuz commented 2 weeks ago

I think your divider in the settings is not correct... did you use 3 m3?

This is mine: image

herm42 commented 2 weeks ago

if i change the counter divider from 1 to 1000 nothing changes ... image

weird

herm42 commented 2 weeks ago

fyi .. i'm on the latest beta

herm42 commented 2 weeks ago

image

i do not understand what this counter divider is used for ... in my case the meter is correct ... 15125.520m³ is the value stored at the zwave meter. So counter divider 1 should be the right one ?

... yes I used 4m³ today

gizmocuz commented 1 week ago

Could you perform the steps here at "Debugging MQTT' and post here the complete config topic name and payload, as well as the data name and payload?

https://www.domoticz.com/wiki/MQTT#Debugging_MQTT

With this I should be able to simulate your gas meter and see why floats are not handled

Did you use 15124.410 m3 gas? This value is correct? (including the 410 part?)

herm42 commented 1 week ago

will provide the mqtt explorer data somewhen at the weekend. correct-> 15124.410 is the exact overall consumption

herm42 commented 1 week ago

{ "type": "sensor", "object_id": "gas_cubic_meters_value", "discovery_payload": { "value_template": "{{ value_json.value }}", "unit_of_measurement": "Cubic meters", "icon": "mdi:thought-bubble", "device_class": "gas", "state_topic": "zwave-mqtt/87/50/0/value/131073", "availability": [ { "payload_available": "true", "payload_not_available": "false", "topic": "zwave-mqtt/87/status", "value_template": "{{'true' if value_json.value else 'false'}}" }, { "topic": "zwave-mqtt/_CLIENTS/ZWAVE_GATEWAY-zwave-js-ui/status", "value_template": "{{'online' if value_json.value else 'offline'}}" }, { "payload_available": "true", "payload_not_available": "false", "topic": "zwave-mqtt/driver/status" } ], "availability_mode": "all", "json_attributes_topic": "zwave-mqtt/87/50/0/value/131073", "device": { "identifiers": [ "zwavejs2mqtt_0xe9a1d9f4_node87" ], "manufacturer": "NorthQ", "model": "NorthQ Gas Meter (NQ-9121)", "name": "Erdgas", "sw_version": "3.30" }, "name": "Erdgas_gas_cubic_meters_value", "unique_id": "zwavejs2mqtt_0xe9a1d9f4_87-50-0-value-131073" }, "discoveryTopic": "sensor/Erdgas/gas_cubic_meters_value/config", "values": [ "50-0-value-131073" ], "persistent": false, "ignoreDiscovery": false, "id": "sensor_gas_cubic_meters_value" }

herm42 commented 1 week ago

{"time":1729768277055,"value":15128.89,"nodeName":"Erdgas","nodeLocation":"Heizraum"}

image

gizmocuz commented 1 week ago

Thank you, I do miss the config topic, you provided only the payload might be something like homeassistet/sensor/xxx/.../config

herm42 commented 1 week ago

{"value_template":"{{ value_json.value }}","unit_of_measurement":"Cubic meters","icon":"mdi:thought-bubble","device_class":"gas","state_topic":"zwave-mqtt/87/50/0/value/131073","availability":[{"payload_available":"true","payload_not_available":"false","topic":"zwave-mqtt/87/status","value_template":"{{'true' if value_json.value else 'false'}}"},{"topic":"zwave-mqtt/_CLIENTS/ZWAVE_GATEWAY-zwave-js-ui/status","value_template":"{{'online' if value_json.value else 'offline'}}"},{"payload_available":"true","payload_not_available":"false","topic":"zwave-mqtt/driver/status"}],"availability_mode":"all","json_attributes_topic":"zwave-mqtt/87/50/0/value/131073","device":{"identifiers":["zwavejs2mqtt_0xe9a1d9f4_node87"],"manufacturer":"NorthQ","model":"NorthQ Gas Meter (NQ-9121)","name":"Erdgas","sw_version":"3.30"},"name":"Erdgas_gas_cubic_meters_value","unique_id":"zwavejs2mqtt_0xe9a1d9f4_87-50-0-value-131073"}

gizmocuz commented 1 week ago

I think you have to re-read the above page, specially

Debugging MQTT Use MQTT Explorer tool

It mentions the icons to copy the topic and payload

gizmocuz commented 1 week ago

for instance, your payload topic is

wave-mqtt/87/50/0/value/131073

I managed to create the config topic myself, so hold on... going to debug the issue.

gizmocuz commented 1 week ago

Could you try beta 16291? You should also get a normal 'Gas' device instead of a RFXMeter

herm42 commented 1 week ago

thx for the fast fix! new "P1 smart meter, Gas" has been detected. :-) Is there a way to migrate the old data to this new device (replace function does not find any destination device)?

gizmocuz commented 1 week ago

Could you send me a message on Slack and send me a backup of your database?

https://join.slack.com/t/domoticz/shared_invite/zt-wo7hrgc3-qIH0EFX_jcBrG2dBSOTRwg

I think it should be possible. The gas meter stores it's values in Meter_Calendar, and I think the RFXMeter device as well If both have the same values (of course your gas meter could be some m3 ahead now), you could also perform a SQL query to set the DeviceRowID of the old meter to the new GAS meter DeviceRowID (First make a backup of your database!!! Twice!!)

Like

UPDATE Meter_Calender SET DeviceRowID=456 WHERE (DeviceRowID=123)

herm42 commented 1 week ago

thx for the info. was able to change the device id and correct the values/counter because of the new counter divider. everything is fixed now!

gizmocuz commented 1 week ago

Great!

waltervl commented 3 days ago

So issue can be closed?

herm42 commented 3 days ago

everything is fine now ... thx for your work!