benzman81 / homebridge-http-webhooks

A http plugin with support of webhooks for Homebridge: https://github.com/nfarina/homebridge
GNU General Public License v3.0
180 stars 55 forks source link

Switch button manually trigger an action, but call the URL to change state don't #162

Closed qubiack closed 2 years ago

qubiack commented 2 years ago

I have an issue with the call on_url method. When I trigger a button manually by the interface it always calls my on_url link and everything work as expected. But when I trigger an action from URL like: http://{homebridgeIP}:51828/?accessoryId=vswitch1&state=true status of the trigger is changed but on_url is not called.

Do you have any idea why it is working in this way?

        {
            "platform": "HttpWebHooks",
            "webhook_port": "51828",
            "cache_directory": "/home/pi/webhooks-cache",
            "switches": [
                {
                    "id": "vswitch1",
                    "name": "Virtual Switch 1",
                    "rejectUnauthorized": false,
                    "on_method": "GET",
                    "on_url": "http://xxx.xxx.xx.xxx/api/test"
                }
            ]
         }
benzman81 commented 2 years ago

Its not meant to work this way. One the hand, you habe Homekit. When you press the button here, you notify another system of the button click by calling the url. homekit then switches the state. On the other hand you have another system that notifies homekit of a state change. But the url will not be called. why should it? The notifying system already knows the new state.