I’ve poked around the forums and can’t quite find anything that works. I have modded my Breville Espresso machine and popped a Shelly1 inside so I can turn it on and off (full guide coming). The switch is a momentary one though so I need to pulse the relay. The code below works just fine but me being fussy, I want to turn it into an on/off switch inside HA:
Hey Marc. Thanks for the feedback. I want a switch (assumed state) to be present in HA. When I turn it on, it runs the script and the coffee machine turns on. When I turn the switch off, it runs the same script again. Obviously I’ll have no way of actually knowing whether it is actually on or off without using another Shelly to measure the power consumption but it seem to be pretty reliable.
The trouble with just using the script is that once it’s run, it shows as off so I want a switch so I can show the assumed state.
You Sir are a freak’n legend! That worked. Never heard of an anchor before too so that is going to save some time going forward. Now to make that modding guide! Thanks again.
Based on @anon43302295 reply I was able to make a switch to close and open 4 screens. I have to apply delays because the screens are controlled by RF-link. The newly created switch screens, can be used by Alexa (hue emulation) : “Alexa turn on screens”. Thanks.