Integration with Openremote

Hi

i have an openremote based system running currently and i want to see if i can bring in the sensor values from it in Home Assistant. Openremote has an API that allows pulling data from it with HTTP calls, Below is an example of HTTP request and response. Is it possible to add these sensors in HA using these calls?

Request:

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/status?name=zooz%20dimmer%20a%20switch%20status&name=zooz%20dimmer%20a%20switch%20status

Response:

<sensors>
<sensor name="zooz dimmer a switch status">off</sensor>
</sensors>

For sending control commands:

Turn off Switch

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20off

Turn on switch:

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20on

Yes, should be easy enough. Have a read of these:

Home Assistant recently had some improvements regarding automatic conversion of XML to json in the restful integrations, so that should help you too, as the responses above appear to be XML.

Thanks. I read through those pages and have the following set up
The Device i am trying to bring in with HTTP in Home Assistant is a wall switch with On/ Off / Status

configuartion.yaml

switch:
  - platform: rest
    name: zoozdimmer_a_switch
    resource: http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/
    body_on: controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20on
    body_off: controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20off

sensor:
  - platform: rest
    resource: http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/status?name=zooz%20dimmer%20a%20switch%20status&name=zooz%20dimmer%20a%20switch%20status   
    name: zoozdimmer_a_switch 

the sensor is bring in the status and updating periodically as expected but if showing the raw response as below. is there any way to parse that string and only display the actual “On” or “Off”

{"sensors": {"sensor": {"@name": "zooz dimmer a switch status", "#text": "on"}}}

With regards to the Switch, it is getting added to the UI as a toggle button.
When i press the button, it seems to only send the link in the "resource field in the switch configuration i have included above. I have wireshark running and i am looking at the messages. How / when does the body_on and body_off get sent?

I think that body_on/off should only contain the message, not the endpoint.

Thanks unfortunately that did not work. I tried the following but it seems to be sending only the link in the “resource”. i also noticed it is sending this every 30 second (maybe as a keep alive) even when the button is not pressed.

When the button is pressed, it still send the same link in “resources”

body_on and body_off is not getting appended when the button is pressed / command is sent.

switch:
  - platform: rest
    name: zoozdimmer_a_switch
    resource: http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/
    body_on: commands?name=zooz%20dimmer%20a%20on
    body_off: commands?name=zooz%20dimmer%20a%20off

any other suggestions / recommendations?

Quoting some things (ie wrapping them with " ")

The only way i was able to get it to work was using

  - platform: command_line
    switches:
      dining_light:
        command_on: curl -s http://192.168.1.3:8655/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20on
        command_off: curl -s http://192.168.1.3:8655/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20off
entities:
  - entity: switch.dining_light
  show_header_toggle: false
theme: Backend-selected
title: Switch
type: entities

any suggestion on how to parse the sensor response to display only “On” or “Off”

currently it is showing the raw entire response
image

sensor:
  - platform: rest
    resource: http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/status?name=zooz%20dimmer%20a%20switch%20status&name=zooz%20dimmer%20a%20switch%20status   
    name: zoozdimmer_a_switch 
detail: 1
entity: sensor.dinning_light_status
name: Dining light status
type: sensor

Why are you making that a sensor if it is a switch?

the switch is to send the on / off command. it is not updating the status as a switch by itself. I tried using co,and state but its really working- it actually makes it stuck in the ON state for some reason. So I am hoping to use a seperate sensor to pull the status which seems to work but need help figuring out how to display just the “on” / “off” instead of the complete json / xml response that is getting display currently.

command_state: http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/status?name=zooz%20dimmer%20a%20switch%20status&name=zooz%20dimmer%20a%20switch%20status

i think it should be doable because it is getting formatted in a json table- but i am not able to figure out the correct may to just display the #text attribute.

below is the json:

{
   "sensor": {
      "@name": "zooz dimmer a switch status",
      "#text": "on"
   }
}

Solution posted here for future reference:

hello. Can u help me?

Hard to know unless you ask a question about home assistant.