Gro-Clock Rule

Trying to setup a Gro-Clock for my daughter's room using an Inovelli RGBW bulb and rule machine.
I want the bulb to turn on as a night light that is pink at 100% (signalling from outside her room that it's bedtime) and fade down to 30% over time as she falls asleep. I then have a separate rule to turn it green at 100% based on time of day or one of our sleep sensors detecting we're out of bed.

I'm having 2 issues.
1: Set color and level. The color changes properly, and the level changes in the device attributes, but the bulb does not actually change levels. I've gotten around this by running a custom action for "setLevel".
2: The fade over time only runs the very first time after I edit this action. The first time I can see the level attribute dropping when I look at the bulb device. After that, the level attribute on the bulb just stays at 100 no matter how many times I run it. I read somewhere that the fade doesn't work well when in the same rule so I also tried splitting it off into another rule with the exact same result. First time the level fades, after that it just stays at 100.

I've also tried setting a variable to 100 and then doing a repeating action that repeats every 1s, 60x to subtract 1 from the variable and issue the custom setLevel action. This should bring it from 100 to 40 over 60s, but the level on the bulb never changes and the repeating seems to ignore the repeat 60 times and just keeps subtracting 1 every second and ends up well below 0.

I'm fighting every instinct to not setup webcore where this would be so simple to do, so any help would be greatly appreciated.

Here's the rule

EDIT:
Removed the custom action and triggered the rule with logging open. It appears the only command being sent to the bulb is the RGB command.
dev:3882020-02-11 08:48:08.422 pm debugr:255, g: 69, b: 225

For any future searchers, I was never able to get this to work through rule machine. I ended up writing it in WebCoRe and then eventually re-did it in node-red using the lullaby node to get exactly what I wanted. Has worked flawless since.

I used a virtual switch so I can also trigger this on/off with double taps on the inovelli switch I have in the room. And yes I realize I've got 7:55am weekday and 7:55am weekend triggers. Normal weekday wakeup time is 7:05 but with Covid we've been enjoying the extra 50mins to sleep.

[{"id":"62e4313f.3b6c6","type":"afya-lullaby","z":"ff73ed77.2a157","name":"Dim over 45Mins","dimmingTime":"2700","startValue":100,"stopValue":"20","step":1,"x":530,"y":2500,"wires":[["be6d87b.46db578"]]},{"id":"be6d87b.46db578","type":"api-call-service","z":"ff73ed77.2a157","name":"Dim Light","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.night_light_bulb","data":"{\"brightness_pct\":\"{{payload.value}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":2500,"wires":[[]]},{"id":"4e163e4e.dbb0d","type":"afya-lullaby","z":"ff73ed77.2a157","name":"Ramp Up over 10Min","dimmingTime":"600","startValue":"20","stopValue":"100","step":1,"x":760,"y":2620,"wires":[["770eb666.85d6b8"]]},{"id":"770eb666.85d6b8","type":"api-call-service","z":"ff73ed77.2a157","name":"Ramp Up Light","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.night_light_bulb","data":"{\"brightness_pct\":\"{{payload.value}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":980,"y":2620,"wires":[[]]},{"id":"5d8b0c9.fbdccf4","type":"inject","z":"ff73ed77.2a157","name":"7:55am Weekday","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"55 07 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"x":110,"y":2600,"wires":[["182a7c56.23aa84"]]},{"id":"73d75d31.e63514","type":"server-state-changed","z":"ff73ed77.2a157","name":"Night Light On?","server":"94fdcfdf.a00b","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.night_light","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":100,"y":2500,"wires":[["2501b371.0d0adc"],["5aeb99fb.bf9118"]]},{"id":"2d408ddb.ea48d2","type":"inject","z":"ff73ed77.2a157","name":"7:55am Weekend","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"55 07 * * 6,0","once":false,"onceDelay":0.1,"x":110,"y":2640,"wires":[["182a7c56.23aa84"]]},{"id":"ca201441.7f9878","type":"api-call-service","z":"ff73ed77.2a157","name":"Turn Off","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.night_light_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":500,"y":2560,"wires":[[]]},{"id":"9fc20f8e.ac9a9","type":"api-call-service","z":"ff73ed77.2a157","name":"Turn On Night Light","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.night_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":2700,"wires":[[]]},{"id":"61b6e5da.f6959c","type":"inject","z":"ff73ed77.2a157","name":"7:15pm Turn On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"15 19 * * *","once":false,"onceDelay":0.1,"x":110,"y":2720,"wires":[["172666cd.c34319"]]},{"id":"dccea50e.083428","type":"inject","z":"ff73ed77.2a157","name":"12:15pm Turn On","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"15 12 * * 6,0","once":false,"onceDelay":0.1,"x":110,"y":2680,"wires":[["172666cd.c34319"]]},{"id":"d77c0632.1914d8","type":"inject","z":"ff73ed77.2a157","name":"8:05am Turn Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"05 08 * * *","once":false,"onceDelay":0.1,"x":110,"y":2800,"wires":[["57c2692b.a330e8"]]},{"id":"57c2692b.a330e8","type":"api-call-service","z":"ff73ed77.2a157","name":"Turn Off Night Light","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.night_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":330,"y":2780,"wires":[[]]},{"id":"2501b371.0d0adc","type":"api-call-service","z":"ff73ed77.2a157","name":"Set Color - Pink","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.night_light_bulb","data":"{\"color_name\":\"magenta\",\"brightness_pct\":100}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":320,"y":2500,"wires":[["62e4313f.3b6c6"]]},{"id":"a01d1f32.b6a81","type":"api-call-service","z":"ff73ed77.2a157","name":"Set Color - Green","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.night_light_bulb","data":"{\"color_name\":\"green\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":2620,"wires":[["4e163e4e.dbb0d"]]},{"id":"3b4cf5fa.c2c89a","type":"inject","z":"ff73ed77.2a157","name":"3:00pm Turn Off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 15 * * *","once":false,"onceDelay":0.1,"x":110,"y":2760,"wires":[["57c2692b.a330e8"]]},{"id":"172666cd.c34319","type":"api-current-state","z":"ff73ed77.2a157","name":"Are we home?","server":"94fdcfdf.a00b","version":1,"outputs":2,"halt_if":"Home - Morning, Home - Afternoon, Home - Evening, Home - Night, Babysitter","halt_if_type":"str","halt_if_compare":"includes","override_topic":false,"entity_id":"input_select.house_mode","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":2700,"wires":[["9fc20f8e.ac9a9"],[]]},{"id":"5aeb99fb.bf9118","type":"unsafe-function","z":"ff73ed77.2a157","name":"Kill Timer","func":"msg.payload=\"kill\"\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":2560,"wires":[["62e4313f.3b6c6","ca201441.7f9878","4e163e4e.dbb0d"]]},{"id":"182a7c56.23aa84","type":"api-current-state","z":"ff73ed77.2a157","name":"Are we home?","server":"94fdcfdf.a00b","version":1,"outputs":2,"halt_if":"Home - Morning, Home - Afternoon, Home - Evening, Home - Night, Babysitter","halt_if_type":"str","halt_if_compare":"includes","override_topic":false,"entity_id":"input_select.house_mode","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":2620,"wires":[["a01d1f32.b6a81"],[]]},{"id":"94fdcfdf.a00b","type":"server","z":"","name":"Home Assistant","addon":true}]
1 Like