After I created the previous post, I updated the firmware to 20230913-114008 and it appears that Shelly has changed the operation of dim up and down URL Actions. They no longer repeat. So, you have to trigger the switch multiple times to ramp up/down.
Because of this, I rearranged my URL actions to the following:
Maybe this is fine for you if you are using the code written by @girkers ? My orginal one still works fine (long press automations for dimming and brightening) and the firmware updates did not affect the dimming or brightening either… ?
Putting the dimming on the switch instead of HA, makes the light fully functional without HomeAssistant. I just took your original goal of “Still be able to at least turn the light on and off even if HA is dead” one step further and enabled dimming from the switch as well.
There is no need for your dimming code in HA, but you still have full control over on/off and dimming within HA.
But you said in your previous post that holding the switch will not continuously brighten or dim the lights, “So, you have to trigger the switch multiple times…” - bummer, it would be great to have it work properly without ha at all…
I am not so into yaml-coding, but I think, this is quite close to what I am looking for.
I want to combine a motion sensor and a classic button-switch (only 1 button, which can either be pressed long or short).
When motion is detcted, the lights should turn on and switch off 1 minute after movement detection → that is working
When I press the button short, the light should toggle and the running “shutdown timer” of the movement automation should be deleted or the automation should stop.
When I press the button long, it should dim the light. For example it should dim up to 100% at the first long press and dim down to 0% at the second long press.
Or another possibility could be to dim up, when the light is below 50% or dim down, if the lights are above 50% brightness.
Do you have any hints for me how I could solve this?