I’m able to send notifications to my phone (OpenHAB app) from a UI defined rule, but I can’t figure out how include the item state in the body of the message!
The item is a string item defined in an .items file like so: String Notification_Leif "Notification (Leif)" <none>
I need to know what to put here, for it to send the item state.
I found some related topics, such as this and this and this but neither example worked – the only notification message I get is exactly what I put in, verbatim.
Is it possible to do this with an UI rule or do I have to write a file based rule?
I don’t think this is possible yet. The simple UI rules are pretty limited. The notification action only supports static messages. If you need more, such as referencing the state of an Item, you’ll have to use an inline script. In 3.4.4 I don’t remember if Blockly has a Notification block or not. If not you’ll have to use code. With JS Scripting it will look something like
actions.NotificationAction.sendNotification("romeo@montague.org", "Balcony door is " + items.MyDoor.state);