I am a newbie regarding openHab. I took me days to understand the principles of this amazing Platform. Although I finally succeeded in integrating my Philips Hue (Zigbee), Tahoma (Somfy), WebCam (Onvif) and Fibaro (Z-Wave) stuff in a first very simple sitemap, I am still not confortable with the advanced topics. But I am really exited and eager to learn as I have seen plenty of great HabPanel screenshots here and try now to do something similar for myself
I was however missing a “button” asking me to confirm if I really want to Switch OFF my devices, such as my Synology (running openHab :D). Looking at samples found in this community, I assembled and fine-tuned the code here attached. Confirm Switch.widget.json (5.6 KB)
I have learned a lot by reading examples, but I would really appreciate if an expert could review my Custom Widget and advice to make it more robust and compliant with the state-of-the-art…
My Custom Widget mimics a Switch. It must be configured with a “Name” and an “Icon” to be displayed on the Widget, and obviously with the item to be controlled. Next, one must configure if turning ON and/or OFF the item required a ‘confirmation’. If a ‘confirmation’ is required, then my Custom Widget will display a message like “Click if you really want to turn OFF/ON ‘the item’”.
Also, if a confirmation is required to change the current state of the item, then I display a Shield in the background of the Widget.
The icon used in the confirmation model popup can also be configured in the Custom Widget settings.