Both! OK, looking at your suggestion for the fade to 1 then off... that seemed to work in a test rule, I'll try implementing that properly later and do some more testing. I also observed a "Fade to 0" doesn't seem to result in any level changes at all, meaning this may be most of the issue here.
I also took your custom app suggestion, and did some digging about, finding a basic app that i could build ontop of... I've hacked it about a bit, just to try and get it working. but i am getting a problem there too with the "runin" function. This seemed like exactly the groovy i would need to get things working. However, thats not really behaving as i would expect either, as the runin is run twice, but it doesnt wait the right amount of time, and then also only triggers once, not twice...
dev:22020-12-14 08:31:49.031 infobedroom Light was turned off
app:5162020-12-14 08:30:41.750 infoSimple Fave Rule Machine
dev:182020-12-14 08:19:29.776 infoBen p20pro has arrived
dev:162020-12-14 08:14:19.184 infoDiningRoomLight was turned on
app:5152020-12-14 08:14:19.095 debugToggling
dev:3102020-12-14 08:14:10.134 infoHall light is 100% [physical]
dev:3102020-12-14 08:14:09.151 infoHall light was turned on [digital]
app:5152020-12-14 08:14:09.108 debugRunin Sent
app:5152020-12-14 08:14:09.051 debugIs ON
app:5152020-12-14 08:14:09.048 debugRun
dev:5522020-12-14 08:14:09.023 infoScen-Test was turned on
definition(
name: "Simple App Example",
namespace: "anonymous",
author: "anonymous",
description: "Toggle output switch when motion and logic switch is on.",
category: "Convenience",
iconUrl: "",
iconX2Url: "",
iconX3Url: "")
preferences
{
section
{
input name: "trigger", type: "capability.switch", title: "Trigger Switch", multiple: false, required: true
input name: "outputSwitch", type: "capability.switch", title: "Output Switch", multiple: false, required: true
input name: "dimmers", type: "capability.switchLevel", title: "Dimmers", multiple: true, required: false
input name: "testDimmers", type: "capability.switchLevel", title: "TestDimmers", multiple: true, required: false
}
}
void installed()
{
updated()
}
void updated()
{
unsubscribe()
subscribe(trigger, "switch", eventHandler)
}
void uninstalled()
{
// unsubscribe to all events
unsubscribe()
}
void eventHandler(evt)
{
//Toggle()
//runIn(5,Toggle)
log.debug "Run"
if(evt.value == "on")
log.debug "Is ON"
runIn(5,Toggle)
runIn(10,Toggle)
log.debug "Runin Sent"
}
def Toggle(){
log.debug "Toggling"
if(outputSwitch.currentValue("switch") == "on"){
outputSwitch.off()}
else{
outputSwitch.on()
}
}
This does make me wonder if there is anything wrong more fundamentally as the groovy does't seem to be working. Though i am totally aware this may just be my god awful initial attempt at hubitat groovy!!