Send commands to the BOT from OH


(Davide ) #1

Hello
I would like to know if it is possible to send commands to the BOT from openhab. I made this rule:

rule "test telegram"

when
Item test received command
then
       val String test_command= "/ledon"
       sendTelegram("bot2", "" + test_command )
end 

writes the command to the chat, but does not run. If instead I write /ledon in the telegram chat it works, and it turns on the led.
Thanks for your help
David


(Vincent Regaud) #2

/ is a special character when inside quotes

Try this:

rule "test telegram"
when
    Item test received command
then
    val String test_command= "//ledon"
    sendTelegram("bot2", "" + test_command )
end 

or

    val String test_command= "/" + "ledon"

(Davide ) #3

the first one writes this on the chat: // ledon

the second one writes the right command: / ledon but messanger does not send the command to the esp8266


(Rich Koshak) #4

\ is the special one. / should be just fine.


(Vincent Regaud) #5

Duh/!


(Vincent Regaud) #6

The you need to look at the bot and your ESP code. It’s not openHAB


(Davide ) #7

I should have understood the problem.
The ESP receives the command if I send / ledon
In fact in the chat appears my name that sends the message to the BOT.
If instead it is OH to send / ledon the command is written in the chat, but without a user and the ESP does not see the command.
I do not understand if it depends on the sketch or it’s a limitation of telegram with OH


(Vincent Regaud) #8

Google arduino/ESP receive telegram message. That should come up with some example code.
But I don’t know if it’s possible. Telegrams are encrypted and encryption is memory heavy and computationally intensive. Maybe too much for arduinos and ESPs.