which of the 2 examples below is closer to what you want to achieve?
It may be better for you to type up a draft rule so we can understand the concept.
Example 1:
You have a temperature sensor that reads the internal temp of your house and it has a refreshInterval=10 (i.e. state updates with new reading every 10 secs)
Now, you want to trigger another Item that controls the boiler and turn it on if the temp will go below 20 and off if the temp will goes above 22.
Example 2:
Same temp sensor as above.
Now, you want to update another proxy Item with certain values based on the results of the first one.
e.g if temp goes below 20 then update proxy with String “Cold”, else between 20 and 22 update with String “Moderate”, else with “Hot”
edit: You cannot control the updates of the temp sensor Item itself based on such conditions since the Item will get “raw” updates from the binding. Unless of course you can implement such logic in the endpoint device itself.
Reading your requirement it sounds you do need an item that does NOT get all updates from a sensor. In this case you would need one item (linked to the sensor, showing the correct value all the time, however this item is probably not shown on a sitemap) and another item, which gets ist updates via your rule.
The rule should be triggered on each change of the linked item. In the rule use a global flag, which gets set TRUE when the value changes below 20 and set to FALSE if above 22. Updates to the unlinked items are sent whenever the flag is FALSE.
Here is a code snippet that I use to update up my ecobee thermostat if it’s 45F degrees or warmer outside and doesn’t update the thermostat again until it drops below 45…
when
Item eb_out_temp received update
then
val otemp = eb_out_temp.state
if (otemp >= 45 && !override_active)
{
override_active = true
sendBroadcastNotification("Start daytime heat boost")
desiredCoolTemp = new DecimalType(80)
desiredHeatTemp = new DecimalType(71)
ecobeeSetHold("4xxxxxxxxxxx", desiredCoolTemp, desiredHeatTemp, null, null, null, null, null)
}
else
{
if (otemp < 45 && override_active)
{
sendBroadcastNotification("Stop daytime heat boost")
override_active = false
ecobeeResumeProgram("4xxxxxxxxxxx", true)
}
}
I need to update it a little so it matches the format of the other DPs but it is still accurate. It basically does what oupus suggested using a flag and what mikmartin’s code does, but the more detailed text description might be useful.