i have a little problem, i have some “things” witch stop recivieng data from here to then. i hafe to disable the thing and enable it again and everything starts working again.
now i searching for a solution witch check the last timestemp of the last recive from an item and the connection state from a thing and if the connection is lost or the last timestemp of an item is older than xx secionds than i want to disable and enable the thing to get it back to work.
so has someone a hint or a solution for me?
thanks in advanced
To get the time off the last update: you can use a profile
To detect thing status: that’s available via rules, you can even trigger a rule of a thing status is changing
a profile? hmm i have to look who this works.
ok the rule have i seen put how can i do an “disable” and “enable” or restart of a thing. i don´t find this in blocky. or do i have to write a rule by my self?
You need to use the restapi the enable / disable a thing.
If you search the forum, you should find several examples
I don’t know how to do that in Blockly, but in RulesDSL it’s something like this.
Note that this is an OH3 example, and may have changed somewhat in OH4.
I recommend disabling/enabling on a schedule so that you’re being proactive. Then it’s a simple CRON rule that doesn’t care about the actual status of the thing.
tactical fix yea sure set up a rule and reinitialize the thing on a recurring basis.
long term strategic fix trouble shoot why you are having to take this action.
What is actually causing the thing to become unresponsive is what I would be chasing if this was happening on my systems.
In JS Scripting there is a
setEnabled() function you can use to enable/disable the Thing.
In the Marketplace there is a generic rule template you can install and use to call a rule of the own when the Things go OFFLINE.
If the Thing remains ONLINE and you can only detect it’s broken because some Items so updating, you can use the Threshold Alert rule template to again call a rule of your own when an Item doesn’t update for a given amount if time. Threshold Alert and Open Reminder [184.108.40.206;220.127.116.11]
The hard part will be mapping the Item to the Thing which isn’t so easy. I would add that as Item metadata.
Is this something (relatively) new?
Not really. I think it’s been a part of the GraalVM JS helper library since the beginning. I know there is similar functionality in jRuby as well.