So in order to do this, my device handler wasn’t really up to par.
Using Fibaro Dimmer 2 behind my Elko switch converted to momentary switch.
The device handler in smartthings for this dimmer isn’t the best,
but thanks to hajar, there was an alternative handler available.
figured ill try it, it works pretty well, better then the handler that is automatically assigned when pairing.
It doesn’t have a completely coverage for my use, maybe fault is laying at smartthings also.
Haven’t checked the logs yet.
smartthings still doesn’t register correctly in the system when light is turned on or off, but shows correctly status in the smartapp, which is good enough for me 🙂
Also having the heos multiroom amp connected both with smartthings and ifttt i’ve figured ill try using it for the automation.
Worked great, but still a issue that you cant do ifttt rules based on time.
Solution for this was creating a virtual switch, that has timebased rules.
So the function tree for playing radio is like this: lights on – trigger ifttt to turn on virtual switch – if its within correct time, then turn on bathroom speakers.
And for turning off, there’s no time limit, didn’t bother as it doesn’t turn on if it isn’t the correct time.
I’ve forked the code for the handler here, huge thanks to hajar for the handler! 🙂
A notice about custom device handlers though, they wont work unless your connected to the web, as all custom codes runs in the cloud, only smartthings approved handlers works locally.
This renderers virtual switches useless in the event off an downtime.
However, didn’t worry about that in this setup, as i have a physical switch connected to the fibaro.
So in the event of downtime, the only thing that happens is that the fibaro wont tell the hub the correct state.
-No worries then, just waiting for family visiting to complain about the awful music in the bathroom whenever they’ll use the toilet 😛