Page 1 of 1

mqtt update value if changed

Posted: Wednesday 05 September 2018 15:24
by emme
Ciao,

it might be possible to add a boolean option in the mqtt string for domoticz/in topic where to update the vale ONLY if the actual value is different (like already done in dzvents with the .checkFirst() function)?
something like:
{"command": "switchlight", "idx": 0, "switchcmd": "Off", "checkfirst": true }
if omitted the "checkfirst": true (or setted to false) the value will be overwritten without control

this would be useful in keeping track of devices and variables state based on a time value (if a variable/switch is not updated for a certain amount of time do stuff)

thank
ciao
M

Re: mqtt update value if changed

Posted: Monday 20 February 2023 13:17
by riko
I was exactly looking for this functionally. Is this already possible, or is there a workaround?

Re: mqtt update value if changed

Posted: Monday 20 February 2023 15:38
by waltervl
I think there is an option in Domoticz menu setup - settings -tab Log history that do just that: "Only add newly received values to the log"

Re: mqtt update value if changed

Posted: Monday 20 February 2023 16:46
by riko
If I understand the manual correctly this is aimed at showing and keeping the data in the log of a sensor. Not about the update of the sensor itself?

Re: mqtt update value if changed

Posted: Monday 20 February 2023 16:48
by waltervl
Give it a try and you will see if it works.
In what manual did you read this?

Re: mqtt update value if changed

Posted: Monday 20 February 2023 17:15
by riko
This is where I found it, it is really a description about how the log is kept: https://www.domoticz.com/wiki/Applicati ... og_History

But you might be right, i'll give it a try later!