I am attempting to setup an HTTP Binary sensor that I can that I can trigger using curl from another machine.
I have added this to my configuration according to the HTTP Doc: :
http:
api_password: 123
I have followed the curl test according to the HTTP Binary Sensor Doc with the below results. As you can see in the below screen shots I have tried it two ways.
Any Ideas?
gpbenton
(Graham)
February 12, 2018, 4:18pm
2
I think all the \
characters are confusing bash.
This seems to work (even before binary_sensor.radio is defined !
homeassistant@graham-lubuntu17:~/testing/apps
$ curl -X POST -H "Content-Type: application/json" -d '{"state": "off", "attributes": {"friendly_name": "Radio"}}' http://localhost:8123/api/states/binary_sensor.radio
{"attributes": {"friendly_name": "Radio"}, "entity_id": "binary_sensor.radio", "last_changed": "2018-02-12T16:15:01.685174+00:00", "last_updated": "2018-02-12T16:15:01.685174+00:00", "state": "off"}
homeassistant@graham-lubuntu17:~/testing/apps
Edit: Note that I don’t have an api_password defined.
I figured it out. for some reason local host wasnt working for me i had to enter the IP address of my server.
Can you run this same command some how in internet explore? Say if i wanted to do this same thing from a Windows machine?
gpbenton
(Graham)
February 12, 2018, 5:16pm
5
No, Web browsers only do ‘GET’, not ` ‘POST’
Thanks, Is there a different way to get this same result or maybe utilizing a different sensor in order to get it to work with a web browser?
HFsi
August 25, 2018, 6:20pm
7
Same problem…I need to send a POST from Macrodroid that contains a number…any ideas?
@HFsi What is the end result in Home assistant you are looking for?
HFsi
August 27, 2018, 6:14pm
9
To show the battery status of a tablet…now I´m doing it trough a file sensor, but it seems a pretty raw method