Thank you very much for the fast replies!
In the meantime I was able to solve my needs.
I wrote a script to use a egg timer with Rhasspy (voice assistant). Do you think it could be interesting for someone. If yes, where is a correct place to post it?
i have tried to posted solution with a timer and tried to rescheduled it in the lamda, but in the mainui the rule doesnt work correct. I get the failure:
1. Cannot refer to the non-final variable timer_sonos inside a lambda expression; line 29, column 1292, length 11
2. Cannot refer to the non-final variable timer_sonos inside a lambda expression; line 33, column 1346, length 11
i have also tried with var ScriptExecution = …, but it doesnt work also.
how can i write a correct rule through the mainui with a time that is rescheduled every 5 seconds?
var Timer timer_sonos = null
else if (scenes.state.toString() == "sonos") {
TasmotaS20_E2B765_state.sendCommand("ON")
if(timer_sonos === null){
timer_sonos = createTimer(now, [ |
// Check the status of the Thing inside the Timer
var thingStatus = getThingStatusInfo('mqtt:homeassistant_E2B765:local_mqtt:E2B765').getStatus().toString()
if(thingStatus == "ONLINE")
{
SonosPlay1_Lautstarke.sendCommand(7)
Sonos_Favorit.sendCommand("Hit List")
timer_sonos = null // line 29
}
else
{
timer_sonos.reschedule(now.plusSeconds(5)) // line 33
}
])
}
}