Updating Last Seen - with no notification
Moderator: leecollings
Updating Last Seen - with no notification
I'm looking for a way to update a domotciz device in order to get the 'last seen' updated, without triggering any notifications ( no trigger of LUA or dzVent script)
Is there a particular way to do that ? As the Update Api from the Python Framework always trigger notification, which could be annoying.
The main issue today is if you have a door sensor, it only update its state on Domoticz when someone Open or close the door. However this sensor is communicating on a regular basic like sending battery information ... ( for instance Xiaomi is sending every 10' a status update). It would be annoying to get a notficiation every 10' while nothing really happen except that the device is alive!
Is there a particular way to do that ? As the Update Api from the Python Framework always trigger notification, which could be annoying.
The main issue today is if you have a door sensor, it only update its state on Domoticz when someone Open or close the door. However this sensor is communicating on a regular basic like sending battery information ... ( for instance Xiaomi is sending every 10' a status update). It would be annoying to get a notficiation every 10' while nothing really happen except that the device is alive!
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Updating Last Seen - with no notification
Sounds like you are really looking for a kind of 'Device.Touch' function.
I would prefer adding an extra function like that rather than continuing to overload the Device.Update function.
I would prefer adding an extra function like that rather than continuing to overload the Device.Update function.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Re: Updating Last Seen - with no notification
I think you found the point and agree with you. This is a kind of device heartbeat.
Is that something making sense ?
Envoyé de mon iPhone en utilisant Tapatalk
Is that something making sense ?
Envoyé de mon iPhone en utilisant Tapatalk
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Updating Last Seen - with no notification
Pushed an experimental 'Device.Touch()' function to the beta channel.
Does that do what you need?
Does that do what you need?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Re: Updating Last Seen - with no notification
Thanks, I have updated the code on my end, Set clause was missing.
It is now on test
Envoyé de mon iPhone en utilisant Tapatalk
It is now on test
Envoyé de mon iPhone en utilisant Tapatalk
Re: Updating Last Seen - with no notification
Line 1434 of PythonObjects.cpp - 'SET' was missing in the UPDATE statementpipiche wrote: Thursday 07 March 2019 12:36 Thanks, I have updated the code on my end, Set clause was missing.
It is now on test
Envoyé de mon iPhone en utilisant Tapatalk
Code: Select all
m_sql.safe_query("UPDATE DeviceStatus [b]SET [/b]LastUpdate='%s' WHERE (ID == %s )", TimeToString(NULL, TF_DateTime).c_str(), sID.c_str());Re: Updating Last Seen - with no notification
@Dnpwwo, I think that API is perfect and doing what it should do.
I'm just wondering to avoid to much Write I/O if a Query should be done prior to write and if the delta between the Read Last Seen, and thhe time to write is below 1 minute, then we do not write .
What do you think ?
I'm just wondering to avoid to much Write I/O if a Query should be done prior to write and if the delta between the Read Last Seen, and thhe time to write is below 1 minute, then we do not write .
What do you think ?
Re: Updating Last Seen - with no notification
@dnpwwo
It looks that there is a side effect not working as expected.
For instance the Touch() is updating the Database , but it seems that the Devices structure seems not to be updated.
SO for example, if you try to access lastupdate from dzVent script it seems not updated accordingly
domoticz.devices(name).lastUpdate
Is that possible ?
It looks that there is a side effect not working as expected.
For instance the Touch() is updating the Database , but it seems that the Devices structure seems not to be updated.
SO for example, if you try to access lastupdate from dzVent script it seems not updated accordingly
domoticz.devices(name).lastUpdate
Is that possible ?
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Updating Last Seen - with no notification
@pipiche,
I think it is better to allow plugin developers to choose how often they call Touch(). This is easy to do by comparing the current time with Device.LastUpdate and only 'Touching' if the difference is greater than x seconds/minutes. Different authors will have different needs so imposing a restriction on them unnecessarily will just cause frustration.
The main event system reads device data prior to invoking the script but I don't know anything about dzVents so can't confirm it does the same. If the database is being updated correctly then I would suggest raising a separate issue on the dzVents sub-forum for this
I think it is better to allow plugin developers to choose how often they call Touch(). This is easy to do by comparing the current time with Device.LastUpdate and only 'Touching' if the difference is greater than x seconds/minutes. Different authors will have different needs so imposing a restriction on them unnecessarily will just cause frustration.
The main event system reads device data prior to invoking the script but I don't know anything about dzVents so can't confirm it does the same. If the database is being updated correctly then I would suggest raising a separate issue on the dzVents sub-forum for this
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Re: Updating Last Seen - with no notification
Make sense.Dnpwwo wrote: Saturday 09 March 2019 1:39 @pipiche,
I think it is better to allow plugin developers to choose how often they call Touch(). This is easy to do by comparing the current time with Device.LastUpdate and only 'Touching' if the difference is greater than x seconds/minutes. Different authors will have different needs so imposing a restriction on them unnecessarily will just cause frustration.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Updating Last Seen - with no notification
My understanding of what you try to achieve with the Touch() function is that you update the LastUpdate field in the database but don't want Lua or dzVents to react (no script Trigger).pipiche wrote: Friday 08 March 2019 22:47 It looks that there is a side effect not working as expected.
For instance the Touch() is updating the Database , but it seems that the Devices structure seems not to be updated.
SO for example, if you try to access lastupdate from dzVent script it seems not updated accordingly
domoticz.devices(name).lastUpdate
Is that possible ?
Without such a trigger dzVents will not renew it's device information.
This is by design and changing it will take away the big performance advantage of only getting device information when really needed and then get all information for all devices, variables, groups, scenes, cameras and settings in one pass.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: Updating Last Seen - with no notification
@waaren you are totally right.