Forcing a status updated when sensor value has not changed

  • Hi - have discussed this over on Domoticz forum, but I guess it's best placed here.

    I would like to use a "fake" sensor from a mysensors node to domoticz to indicate that a particular sensor that has "real" sensors is still alive - the sensors won't change often but I want to know that everything is well - the plan is have three "switches" presented - two linked to rea external sensors - the other, no physical device attached - I wait in the loop for interrupt on either switch and also for a timeout - when I wake - I check switch state - if changed - send update - and also send "on" to the dummy sensor .

    this i hoped would make domoticz update its last seen time - but it doesn't - if the switch state does not chnage then the update is ignored - i have confirmed this by modyfying mysensorsbase.cpp to take out the "don't update if nothing changed code".

    my question/suggestion is perhaps we should update last seen time - even if we don't actually update the status of the switch (although I have a use case for updating even if value the same)

    would like to hear what others think.

  • Hardware Contributor

    I have allready requested the sendheartbeat() thats included from 1.6.0b to be implemented, but at this moment im having a hard time to convice Gimzocus... my suggestion was that this would update "last seen" without updating the value.

    If you think its a good idea you could send a +1 on my post or something.

  • Have added my request to yours - however, I am not sure who "owns" the code for the mysensors "hardware" for domoticz - in my thread I detail the hack I did to the mysensorsbase.cpp file to make it always update a switch when requested - even if the value has not changed - in my case - this gives me the ability to add a "heartbeat" sensor to any node and update it from the sketch - not as neat as having sendheartbeat supported - but it works for me - but having to make that change every time i update domoticz is a pain. (

    Although nobody has said "its not up to me" - nobody has said - "it works like that for a reason" - I think the change for this would need to come in the mysensorsbase code set - and whilst that is shipped with domoticz - I don't know who actually wrote it - Gimzocus kind of suggested that "it had probably been coded a certain way" - that sounded like he wasn't looking after the code - but I might be wrong on that.

  • Hardware Contributor

    No clue, but its on github so if you have a fix you could make a pull request...

  • I thought about doing that - but the point is it is coded specifically to behave in the "no update" way - my change isn't a fix but a reversal of some deliberate logic - so if I change it - "someone" might just change it back - the best way would be to implement it as a configuration option - but that is a lot more work that my "dirty hack" of chopping out the checking code.

    I will take another look when the 1.6 code is released and see when the options are then.

  • Mod

    @malarcy could you post which line(s) you changed in hardware/MySensorsBase.cpp ?

  • Mod

    Never mind, found it in

    I think the best is to just make a pull request to remove the check.

    The comment doesn't say why "last seen" shouldn't be updated. The commit message (b8771dbdaf98eb6f82e23058d4e8f3b9cbe94f68) doesn't say why "last seen" shouldn't be updated. So it seems to just be a simple mistake.

    Building a new feature to get around a bug is usually a bad idea. It is confusing for users, who read the UI and think "last seen" actually means "last seen". It is confusing for developers, who need to somehow learn to use the new feature to get the behavior they expect. And it will trip up the existing feature in Domoticz that marks widgets in red if they haven't been seen for a while.

  • Hardware Contributor

    sendHeartBeat() has now been implemented in Domoticz 馃檪

  • Hero Member

    @sundberg84 Is there any trick to get this to work in Domoticz ?

    I have just added a heartbeat to one of my sketches and I don't see any changes in the last seen time for that node in Domoticz.

    The serial monitor for the node reports the heartbeat is sent

    TSP:MSG:SEND 8-8-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:1258134
    Heartbeat Sent

    But I get nothing in Domoticz, should I see it in the log file?

Log in to reply

Suggested Topics

  • 3
  • 11
  • 7
  • 2
  • 5
  • 1
  • 2