The behavior you will probably need to implement in a Rule or use the Expire binding, depending on how long you want the button to remain ON after being pressed. If a seconds isn’t too long
Switch MyButton { expire="1s,command=OFF" }
If it needs to be shorter
rule "Reset button"
when
Item MyButton received command ON
then
createTimer(now.plusMillis(500), [ | MyButton.sendCommand(OFF) ] )
end
It is not good enough. I’m not quite sure why, I suppose that sendCommand(OFF) would send a new command to switch, in my example, 1 (ON) to modbus binding instead turn off the trigger.
Do You know where I cant find original switch html/java code?
Hi Jakub,
I’v installed your widget to control a doorlock. The doorlock is connected to a velbus relay.
Works fun when the widget is used on a mac/pc: pushed = activated, else not.
When used on an ios device the behaviour is different: pushed = activated for a slit second, then not.
Any idea on how to fix this? I would like a nice momentary button on my phone to open the door…
btw: great work, been looking for this for a while.
Hi @roelwelters,
I read about it earlier in this forum. I suppose that this is not a problem of the widget itself but the entire habpanel operating under the ios system.
Hi @Hossein_Piri,
I don’t know why it works differently in your Habpanel and I don’t know solution yet, but I think about it.
If you find a couse of error yourself, write. Maybe someone will use it
Dear Jakub,
You widget works perfect, but there is a small estetic problem, the name on the button shows the name of the Item, and not the name given in the settings of the button !