Rule with sendHttpGetRequest not working


(Emiel) #1
  • Platform information:

    • RPI 3B +
    • Openhabian
    • Java Runtime version_1.8
    • openHAB version:Openhab 2.40.0
  • Issue of the topic:
    I am making an connection from mij Ophehabian rpi 3B+ tot my Pimatic rpi 3
    So I can control bij the REST Api of Pimatci , my Pimatic server.
    T do so I wrote a rule to send HTTP get to my Pimatic.
    But it does not work. I use the Demo setup of Openhab and use this rule:

rule “Pimatic Schak ON”
when
Item Pimatic_Schak received update ON
then
sendHttpGetRequest(“http://192.168.1.37:80/api/device/wallplugeettafel/changeStateTo?state=true”)
Light_GF_Living_Table.sendCommand(50)
end

rule “Pimatic Schak OFF”
when
Item Pimatic_Schak received update OFF
then
sendHttpGetRequest(“http://192.168.1.37:80/api/device/wallplugeettafel/changeStateTo?state=false”)
Light_GF_Living_Table.sendCommand(1)
end

If I paste the http line into my browser this line works and swithces something in my Pimatic.

Can anyone help me what I am doing wrong here?


(namraccr) #2

This doesn’t really say anything. Is it throwing errors? What do the logs say?
Also, please review the tutorial on How to ask a good question.


(Emiel) #3

I solved the problem. Somehow Pimatic needs an user:passw@url when you send it e.g. with curl or a Openhab rule. If I use a browser like Chrome you can simply type the url like in the rule and don’t need the username passw.