[SOLVED] Disable switch inputs temporarily (changing button type?)

  • Hi, I would like to implement a way of temporarily disabling the physical switch inputs / buttons on a Shelly 2.5

    My goal would be having a switch in Home Assistant (HA), where "on" would be toggle mode, and "off" would be detached mode.

    But I don't know how to reflect this in HA in real-time - it would have to "query" the Shelly settings on startup, and then update the switch state according to the Shelly response, whenever the URL is called.

    My question is, am I going in the right direction with this idea? Is this the right approach?

    I have Home Assistant (HA) with which I can remotely trigger the devices, but I still want them to operate autonomously in case HA malfunctions or the Wi-Fi is out.

    I also very much like having the Shelly in Shelly Cloud, which allows me to very easily access the device anytime, anywhere.

    This means I don't have MQTT enabled - this would disable Shelly Cloud.

    So in essence I have Shelly Cloud, HA integration through CoIoT, and I can operate the buttons connected to the device.

    With this scenario, in normal operation the Shelly "button type" must be in a physical mode, in my case it's toggle.

    It can't always be in detached mode and having HA decide what to do with the button presses. Also it's much better to have the Shelly react instantly to a button press.

    Still, I can switch between toggle and detached modes using the URLs: http:// shelly-ip /settings/roller/0?btn_type=toggle and http:// shelly-ip /settings/roller/0?btn_type=detached

    Also, anytime I open these URLs, the Shelly returns the complete settings for the roller shutter mode, indicating the current setting for "button_type" as well.

    When I open the URL http:// shelly-ip /settings/roller/0 the device also returns the settings for the roller shutter mode.

    Usage examples:

    When the house alarm is Armed, disable / detach the buttons on some Shelly devices. When we get home, re-enable them.

    When the cleaning lady comes in with her kid, keep some Shelly devices disabled for safety.

    Anyone ever tried to accomplish this?

    Any input will be very appreciated.

    Many thanks

  • I investigated further and this is achievable in HA - it's just a matter of getting the coding right.

    This will create a "virtual switch" for button_type=toggle/detached

    If this parameter is changed outside of HA, it will still show the correct setting with a 10-15 second delay.

    (Language: YAML)

  • footswitch 27. April 2022 um 18:15

    Hat den Titel des Themas von „Disable switch inputs temporarily (changing button type?)“ zu „[SOLVED] Disable switch inputs temporarily (changing button type?)“ geändert.
  • Can I ask why you chose to use the "Detached" switch mode vs Enable / Disable physical switch? I'm still not clear on the difference in the two settings