@kayasaman wrote:
Hi,
the simple answer to this is most likely “no, not possible” as the documentation explicitly states that the Restful API in HASS only supports JSON, so here is my issue:
My GCE IPX800 controller only supports sending http push messages for On/Off states. Is there a way without using JSON to communicate from the IPX to HASS?
I am able to connect to the IPX from HASS without any issue but unfortunately for binary sensor devices like PIR’s the updates are not instantaneous and additionally frequent polling from HASS tends to receive a ‘timeout’ from the controller, meaning the state is not updated within HASS.
This is an example of the entry in the configuration.yaml file:
binary_sensor: - platform: rest resource: http://<ip_address_of_ipx>/api/xdevices.json?Get=D value_template: '{{ value_json.D33 }}' name: "Door"
The actual output from the IPX is in XML but using the value_json template I am able to acquire the state, instead of using many shell based ‘cut’ and ‘grep’ commands in a long string.
An ideal solution would be to send something like:
http://<ip_address_of_hass>/api/states?binary_sensor.door=on http://<ip_address_of_hass>/api/states?binary_sensor.door=off
to HASS upon state change.
Using curl of course this works fine to change the state of the sensor in HASS:
curl -X POST -H "Authorization: Bearer token" -H "Content-Type: application/json" -d '{"state": "on", "attributes": {"friendly_name": "Door"}}' http://localhost:8123/api/states/binary_sensor.door
Unfortunately I can’t input it into the IPX
The side effect from using HASS to poll the IPX is that sensors do not get updated and show the wrong states; as you can see in the image, the Front Door is being shown as ‘open’ but it is in fact closed. Additionally the PIR’s do not show motion properly either, so there maybe motion but HASS will show the location as being ‘clear’.
Does anyone have a solution or perhaps a different suggestion?
Thanks.
Posts: 2
Participants: 2