I need help postUpdate from number to open/closed rule

What am I doing wrong ?, because from number to number it does succeed

this is my rule:

rule "test rule"
when
    Item testbutton changed to ON
then
    if( shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos == 100) 
    { 
      shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos.postUpdate(OPEN)
    }

end

shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos is an Item. An Item carries a state along with a whole lot of other stuff. If you want to compare the Item’s state to 100 you need to ask for the state.

if(shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos.state == 100)

Thanks for the reply,
I add .state but still I do not see the item status as OPEN

then log out the state of the Item to see what it actually is.

Look in events.log to see if the Item is changing state.

I only see testbutton item change to ON
and the item
shelly_shelly25_roller_68c63afb1a9c_roller_rollerpos not appear

In principle, I need it to send updates of items to the telegram, so maybe it is possible to insert the transform file as I defined in labels in sitemap. Is this possible?

Anything is possible but there isn’t enough information here to really do much helping.

Yes you can use the transform action to apply a transform to a String in a rule. But that’s not related to anything you asked about in your first question.

1 Like

Okay so I was able to get the desired result but I would like to add ICON of the off / on lamp, as in the sitemap

You’ll have to look at the Telegram docs to see how to attach an icon to a Telegram message, if it is possible at all.

Thanks, I’ll check there

I looked at the telegram binding page and it seems to me that this is how it should be but I do not get anything in the telegram

    rule "to test updates seen"
    when
        Item testbutton changed to ON
    then

        sendTelegramPhoto("bot1", shelly_shelly1_f4cfa27683a2_relay_output.state.toFullString, "sent from openHAB")
    end

Is

shelly_shelly1_f4cfa27683a2_relay_output

an image / output of a cam ?

No, it’s a lamp item
I want to add an icon like this for example:
צילום מסך 2020-12-12 075148 Per line in the telegram

The only option that I see that should work is sending a html formatted message. The message then needs to include a link to an icon. In case there is a UTF-8 or UTF-16 symbol for the lamp it even might work better. As pictures are being shown as preview.

There is an example mode of how I should list all of this?
In the telegram.cfg file I added: bot2.parseMode=HTML

I would use the telegram binding ( v2 ) and not the telegram action ( v1 ).
An example that uses curl to send the message:

#/bin/sh
TELEGRAM_BOT_TOKEN='<Put-the-bot-token-here>'

curl -X POST \
     -H 'Content-Type: application/json' \
     -d '{"chat_id": "<putchatidhere>", "text": "This is a test from curl <a href=\"https://www.carspecs.us/photos/c8447c97e355f462368178b3518367824a757327-2000.jpg\"> ‏ </a>", "parse_mode" : "html", "disable_web_page_preview" : false, "disable_notification": false}' \
     https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage

The resulting message shown in telegram app:

Put this into the message:

\uD83D\uDCA1 This is a test from curl

and you will get
Screenshot from 2020-12-12 11-31-18

1 Like

thanks it works.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.