alexryd / homebridge-shelly

Homebridge plugin for Shelly devices
MIT License
301 stars 45 forks source link

new option to invert switch state #136

Open softlion opened 4 years ago

softlion commented 4 years ago

Hey :) I would like to thank you for your work !

I am using shelly 2.5 devices in switch mode to control and measure the power used by electric radiators/heaters. By controlling a radiator/heater i mean switching it between PROGRAMMED (ECO) and DEFAULT (CONFORT) states, using its PILOT wire. This wire is quite common.

image

When the first switch of the Shelly 2.5 has its relay OPENED, the pilot wire has no signal. Thus the radiator/heater is in ECO mode. When the relay is closed, the pilot wire gets a normal 220V signal. Thus the radiator/heater is in CONFORT mode.

This means that to "switch off" (ie: in eco mode) the radiator/heater, the shelly switch must be ON (relay closed). This feels strange on UI ! Alterco does not provide this option on the switch itself. It would be nice that this plugin provides it !

It could be a config option on device:

 "devices": [
                {
                    "id": "BB3CC7",
                    "name": "xxx",
                    "switch1inverted": true, //Shelly 2.5 first switch
                    "switch2inverted": false, //Shelly 2.5 second switch
                }
            ]
alexryd commented 4 years ago

I’m pretty sure the input states of the Shelly 2.5 can be inverted. Isn’t there an option to reverse the buttons when configuring the device? There’s a setting in the API called btn_reverse.

softlion commented 4 years ago

I’m pretty sure the input states of the Shelly 2.5 can be inverted. Isn’t there an option to reverse the buttons when configuring the device? There’s a setting in the API called btn_reverse.

You did not understood correctly. I am not using the physical input switch. So the setting from your suggestion does not apply nor solve the problem

alexryd commented 4 years ago

I thought this setting applied to switching the relay both using the physical switch and using the API. Anyway, I can add this option to the plugin.