Supereg / homebridge-http-switch

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

Just asking for some help, regarding pushing a state. #48

Closed chriscn closed 4 years ago

chriscn commented 4 years ago

I have managed to setup the HTTP Notification server with a switch.

{
            "accessory": "HTTP-SWITCH",
            "name": "Hot Water Pump Relay",
            "notificationID": "F27902",
            "onUrl": "http://192.168.113.231/relay/0?turn=on",
            "offUrl": "http://192.168.113.231/relay/0?turn=off",
            "statusUrl": "http://192.168.113.145:8183/F27902/status"
}

I have also setup a Webserver that whenever it turns on and off it sends a post request to the Notification Server. Which one should I use the notification server or could you give me an example of what to POST to the plugin to update switch state?

Supereg commented 4 years ago

For the request structure refer to https://github.com/Supereg/homebridge-http-notification-server#implementation-in-the-http-application-sender and at the bottom of the README of this plugin are all supported Characteristics listed.

Basically this would be the structure, where value can be change to the state you want to set.

{
    "characteristic": "On",
    "value": true
}
chriscn commented 4 years ago

Am I correct in thinking I don't need to include the Status URL in the accessory? That the notificaton server handles that for me.

Supereg commented 4 years ago

With the current behavior you will still need that or rather, the switch will still use it. But you can Settings the „switchType“ in your config to „toggle“. Then the statusUrl will not be used an you can omit it. This should also improve your response time.