That will get the first level. But you’ll still need to save a flag to see if you’ve sent an alert only the first time the level > 20 and not send another one until after the level drops <= 20. I showed that above but it’s just a couple of extra lines utilizing the cache.
I think I got it…
Item (without link to a thing) to trigger the Message:
label: Int_level_max
type: Switch
category: water
groupNames: []
groupType: None
function: null
tags:
- Alarm
- Level
Rule to switch item:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: level
type: core.ItemStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: |-
if (level.state > 25)
{
Int_level_max.sendCommand(ON)
}
else if(level.state < 19)
{
Int_level_max.sendCommand(OFF)
}
type: script.ScriptAction
Rule to send message:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: Int_level_max
state: ON
previousState: OFF
type: core.ItemStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: >-
val telegramAction =
getActions("telegram","telegram:telegramBot:TelegramBot")
telegramAction.sendTelegram("level > 90cm")
type: script.ScriptAction
Of course. It was assumed in the Telegram rule, following the proxy from OFF to ON. I wasn’t specific.
configuration: {}
triggers:
- id: "1"
configuration:
itemName: Int_level_max
state: ON
previousState: OFF
type: core.ItemStateChangeTrigger
conditions: []
actions:
- id: "2"
configuration:
ruleUIDs:
- TelegramScript
type: core.RunRuleAction
It wasn’t from the beginning. I just figured that out.