Rule updating status of Item and sending Message

Hi,

I would like to request an update of an item and send the status by Telegram.

This is my item:

String    UG_Heizung_Wasser_Signal "Wassermelder [%s]" <water>		     (UG_Heizung, HM)			{channel="homematic:HM-Sec-WDS-2:LEQ1234567:MEQ1234567:0#SIGNAL_STRENGTH"}

This is what I tried with rules:

when
    Item UG_Heizung_Wasser_Signal received update
then
    sendTelegram("botTimo", "Wassermelder-Update: Alive! Signalstärke: %s ", UG_Heizung_Wasser_Signal.state)
end

rule "Status Wassermelder 2"

when
    Time cron "0 7 0 1/1 * ? *"
then
    sendTelegram("botTimo", "Wassermelder-Cron: Alive! Signalstärke: %s ", UG_Heizung_Wasser_Signal.state.toString)
end

Is anybody able to help. To get into Rules is very hard for me. My TelegramBot is working. This is not the issue.

Greetings,
Timo

Try sending just one string

sendTelegram("botTimo", "Wassermelder-Update: Alive! Signalstärke:  " +  UG_Heizung_Wasser_Signal.state)

Thank you! I will try tonight.

Do you know how to request an update for an item? Especially for a Homematic item?

Some bindings and devices support sending a REFRESH command to an Item. Don’t know about yours.

Note that if you do use (or can use!) e.g.
myItem.sendCommand(REFRESH)
in a rule, then you should NOT expect an immediate response. The new state will NOT be available in the next line in the rule. The best way would be to trigger another rule from the expected Item update.

Seems not to work for the Homematic binding.

and

sendTelegram("botTimo", "Wassermelder-Update: Alive! Signalstärke: %s ", UG_Heizung_Wasser_Signal.state)

both leads to the output

Wassermelder-Cron: Alive! Signalstärke: NULL

in Telegram. Even though the

2018-12-18 00:40:01.199 [thome.event.ItemStateEvent] - homematic_HM_Sec_WDS_2_LEQ1234567_MEQ1234567_0_SIGNAL_STRENGTH updated to 3

while adding it to the default.items. Sadly this update only seems to happen once while adding it. No change, no update, no alive funktion…?

Any ideas to solve my problem?

Look into the events log. If your Item once gets updated with a value, what is updating it to NULL again?

This might be relevant

was the last entry into the log. It is strange.

The issue described by Stefan Haupt is a different. My installation is new based on OH 2.3 with autodetection of CCU2.

If I deactivate the item in my default.items by “//”, save it and remove the “//” afterwards and save again; I recieve an update in my log file. The rule based on the following seems not to react on it.

when
    Item UG_Heizung_Wasser_Signal received update

My challenges are still:

  1. Why does sendTelegram submit NULL while the last log entry shows 3?
  2. How do I force the Homematic device to tell me it’s status?
  3. Why does my rule not react on a forced update via default.items update?

My idea is to have two seperate rules:

  1. Forcing the update of the current signal strength of the Homematic device at 9:00am in the morning.
  2. Send the information via sendTelegram after receiving an update.

I really appreciate any help! Thanks a lot for this community.

Let’s find out, add simple diagnostics to your “update” rule. Ignore telegram for now, the problem is about Item states.

rule "to test updates seen"
when
    Item UG_Heizung_Wasser_Signal received update
then
   logInfo( "testingupdate", "Update was " + UG_Heizung_Wasser_Signal.state )

//    sendTelegram("botTimo", "Wassermelder-Update: Alive! Signalstärke: %s ", UG_Heizung_Wasser_Signal.state)
end

As we’re concerned about missing updates, let’s have a periodic check

rule "Cron job every minute"
when 
    Time cron "0 0/1 * * * ?"   // every minute
then
   logInfo( "testingupdate", "Cron Item is " + UG_Heizung_Wasser_Signal )
end

This rule should log out Item type etc. as well as state.

Put your Item on your sitemap so that you can manually alter it

Switch item=UG_Heizung_Wasser_Signal mappings=[4=4, 6=6]

My thoughts at this time are that your Item is strange in some way - duplicate name, unusual characters.

I don’t know if Homematic binding will generate an update if the value doesn’t change. Not all bindings will.

There doesn’t seem to be a way to do that. But if the Item state is maintained reliably, you can of course report it at a fixed time.