Supereg / homebridge-http-switch

Powerful http switch for Homebridge: https://github.com/homebridge/homebridge
ISC License
219 stars 36 forks source link

Documentation of POST command #57

Closed mbierman closed 4 years ago

mbierman commented 4 years ago

This is probably more of a bug with the documentation than the plugin. I'm looking to do a POST including some data from a stateless switch. The doc says,

Down here are all characteristics listed which can be updated with an request to the homebridge-http-notification-server

But then nothing is included. Can you provide an example of a POST command?

Supereg commented 4 years ago

Well a line below there it is:

characteristic "On": expects a boolean "value"

It is required to look to the notification-server-repo for the actual POST request, as this information is shared between all my plugins: https://github.com/Supereg/homebridge-http-notification-server#implementation-in-the-http-application-sender

There it notes:

{
    "characteristic": "On",
    "value": true,
    "password": "your-top-secret-password",

    "accessory": "example-accessory", // optional, plugin defined 
    "service": "switch-service", // optional, plugin defined
}

Now you can deprive from the line characteristic "On": expects a boolean "value" how the request should look like.

characteristic must be "On" and the value must be boolean (signaling On or Off state)

meaning a POST body of the following should work (assuming you don't have a password)

{
    "characteristic": "On",
    "value": true // or false if you wan't to turn it off
}