Trigger only on changes
-
Mattias
Trigger only on changes
I’ve been using your mqtt plugin a couple of months with a tasmota/wemos d1 mini and temp sensors. It’s working very good.
Now I tried to connect a rainsensor (a counter in tasmota) and it’s also working just fine.
The issue Is that the device publish every tele period to the broker, regardless of change or not, and this floods the Indigo db. So far I haven’t figured out a way only to publish changes.
Is there a way with the connector trigger to trig on changes in the message, (the counter value) when they arrive to Indigo? (Or some other method). In that way the indigo db will only get values when anything is happening.
(I can always extend the teleperiod on the publishing side, but don’t want to do that, since then i will nit know when the rain begins)
Mattias
Now I tried to connect a rainsensor (a counter in tasmota) and it’s also working just fine.
The issue Is that the device publish every tele period to the broker, regardless of change or not, and this floods the Indigo db. So far I haven’t figured out a way only to publish changes.
Is there a way with the connector trigger to trig on changes in the message, (the counter value) when they arrive to Indigo? (Or some other method). In that way the indigo db will only get values when anything is happening.
(I can always extend the teleperiod on the publishing side, but don’t want to do that, since then i will nit know when the rain begins)
Mattias
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
What exactly do you mean by
Are you talking about excess log messages? Excess writes to the SQL Logger? Or something else?
?floods the Indigo db
Are you talking about excess log messages? Excess writes to the SQL Logger? Or something else?
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
Mattias
Re: Trigger only on changes
My setting is to publish the counter value from the rainmeter every minute, which results in 60x60x24=86400 entries to the db table per day. And most of that data is not relevant if it hasn’t been raining.
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
Which DB are you talking about? The Indigo database? Or SQL Logger's database? The Indigo database is XML, and doesn't have tables. If it's the SQL logger, there's an option in the plugin config to not write entries with no changes.Mattias wrote:My setting is to publish the counter value from the rainmeter every minute, which results in 60x60x24=86400 entries to the db table per day. And most of that data is not relevant if it hasn’t been raining.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
By the way, your math is off. It would be 86400 if you published every SECOND. Every minute is 60x24 or 1440 entries per day.Mattias wrote:My setting is to publish the counter value from the rainmeter every minute, which results in 60x60x24=86400 entries to the db table per day. And most of that data is not relevant if it hasn’t been raining.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
Mattias
Re: Trigger only on changes
Oh yes! the math is definitely off. The db is the postgres that sql-logger is feeding
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
Do you have this enabled?
- Attachments
-
- Screen Shot 2020-02-14 at 10.50.41 AM.png (148.99 KiB) Viewed 3626 times
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
-
Mattias
Re: Trigger only on changes
Great, It might be that simple! I’ll check when I get home tonight.
Re: Trigger only on changes
I changed the sqllogger configuration to store changes, but it's still logging every update.
(I did mess up my forum login and username, therefor the silence and my new login name which Matt help me set up)
(I did mess up my forum login and username, therefor the silence and my new login name which Matt help me set up)
- Attachments
-
- Screen Shot 2020-02-14 at 7.16.18 PM.png (111.31 KiB) Viewed 3499 times
Re: Trigger only on changes
and, the picture shows the data when I switched config to only log on device change.
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
Honestly, I don't know anything about the SQL logger. But I think this issue needs to be solved there. The Shims plugin is getting an update message, so it updates the device. Adding any logic to that process is, IMHO, out of scope.
Is there any other Indigo plugin that does that?
Is there any other Indigo plugin that does that?
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Trigger only on changes
thanks, It sounds resonable.
- matt (support)
- Site Admin
- Posts: 21542
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Trigger only on changes
By adding a new global property to the device you can have the SQL Logger ignore updates for specific states. In this case new table rows are being added because the state id and state ts update every time, but you aren't interested in those state updates (there might be other states you want to ignore too, but from your screenshot those 2 definitely should be ignored). To have the SQL Logger plugin ignore those state use the Global Property Manager plugin to define a new key (sqlLoggerIgnoreStates) that's value is a comma separated list of states that will be ignored. Setting sqlLoggerIgnoreStates to * will ignore all state updates for the device. Note ignored state values will still be written to new device rows if there is a non-ignored state update (the ignore list only prevents triggering new rows to be added), but you will see far fewer new rows added to the table.
Here is a screen shot example of what it will look like in the Global Property Manager plugin. For key you will use sqlLoggerIgnoreStates and for value you will use:
id, ts
(not brightnesslevel, onoffstate like the screenshot)
Here is a screen shot example of what it will look like in the Global Property Manager plugin. For key you will use sqlLoggerIgnoreStates and for value you will use:
id, ts
(not brightnesslevel, onoffstate like the screenshot)
- Attachments
-
- Screen%20Shot%202020-01-27%20at%204.32.26%20PM.png (691.6 KiB) Viewed 3472 times
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Trigger only on changes
That's pretty sweet, Matt.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Trigger only on changes
I tested the global property and it look like it's working. Brilliant! Thanks
