Supereg / homebridge-http-switch

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

Error on Stateful switch. #102

Closed mrfatboy closed 2 years ago

mrfatboy commented 2 years ago

I am getting the following error in the logs when I set the switch to "stateful". The switch works fine when set to "stateless" or "toggle". It seems the plugin has a problem with a list of urlobjs when the switch is set to "stateful". Homebridge, npm, node, and all plugins up to date.

Am I missing something or is this a bug?

Thanks for a great plugin.

image

    {
        "accessory": "HTTP-SWITCH",
        "name": "Scenes Music Time",
        "switchType": "stateful",
        "multipleUrlExecutionStrategy": "series",
        "onUrl": [
            {
                "method": "GET",
                "url": "http://192.168.1.11/YamahaExtendedControl/v2/main/setPower?power=on"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.12/YamahaExtendedControl/v2/main/setPower?power=on"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.13/YamahaExtendedControl/v2/main/setPower?power=on"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.14/YamahaExtendedControl/v2/main/setPower?power=on"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.15/YamahaExtendedControl/v2/main/setPower?power=on"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.16/YamahaExtendedControl/v2/main/setPower?power=on"
            }
        ],
        "offUrl": [
            {
                "method": "GET",
                "url": "http://192.168.1.11/YamahaExtendedControl/v2/main/setPower?power=standby"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.12/YamahaExtendedControl/v2/main/setPower?power=standby"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.13/YamahaExtendedControl/v2/main/setPower?power=standby"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.14/YamahaExtendedControl/v2/main/setPower?power=standby"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.15/YamahaExtendedControl/v2/main/setPower?power=standby"
            },
            {
                "method": "GET",
                "url": "http://192.168.1.16/YamahaExtendedControl/v2/main/setPower?power=standby"
            }
        ]
    },
mrfatboy commented 2 years ago

After doing more reading I see having multiple urls are not supported by “stateful” switch option.

I have a Yamaha MusicCast system with 6 speakers. They all have to be turned on individually. There is no ‘Master on/off” switch. However, I can Pull the status of one of the speakers to determine if all are ON/Off.

So what I really need is a “stateful” switch that can have a list of multiple urls for on/off AND be able to “pull” the status from.

Can anybody suggest a work around or maybe this feature can be implemented?

Edit. 1

Maybe the “toggle” switch will accomplish what I need. I will try it out.

Edit 2

“Toggle” does not have ability to check statusurl. I guess I’m back to square one 🤪

Thanks