Adding Selection to Simple Automation

Some bulbs and/or switches (z-wave) seem to only go up to 99 for the On level. So if you had a switch that On is really 99 then in simple automation when you want to set a level say 15 and in the rule you have a selection of just "Turned On" the bulb will never get set to 15 because the previous level was not 99.

Is there a way to add the following to SA?

The device should have two relevant attributes: switch, which tracks the state (on or off) and level, which tracks the level (1-100 or 1-99 for most Z-Wave devices due to what the spec says for those, as you've noticed; 0 is also technically allowed but usually doesn't report as such and just sends an "Off" command if set, leaving the previos level as what's reported).

SAR would check the switch attribute to see if the device is on or off, not the level attribute, so I'm having a hard time imagining where the problem above would happen. Could there be something else going on? I'm wondering if having the same switch selected for the switch to turn on and the switch to trigger that turning on couldn't be confusing SAR a bit, though I assume you're just trying to make a default "on" level and color and it looks like that should work...

@bertabcd1234 This one is a bit hard to describe. I first made a rule that turns the bath light to On during the day. I made a second rule that changes the level to 15 at night. The rule for 15 did not work because the first rule was changing the switch to supposedly On (during the day) but actually it was at a level of 99. So when we went to turn on the light at late night the switch was set to 99 instead of On which the second rule was looking for On and not 99 so the level was never set to 15. Wow.

I'm still a bit confused (a device can be on or off regardless of level; "on" doesn't mean "100"), but here are a few facts that might help you piece things together based on what you know about your devices and your automation that I may not:

  • SAR does not look at the level attribute to check if a device is on or off or to see when it gets changed from on to off or vice versa; the switch attribute is relevant here. Both of these can be seen under "Current States" on the device page. They are independent (other than that doing a "Set Level" to 0 will usually cause the device to turn off, resulting in "switch: off" and that doing a "Set Level" if a device is off will--unless prestaging is supported and enabled--turn it on to that level, resulting in possible changes to both the "switch" and "level" attributes)
  • If a device does not report a change from "switch: off" to "switch: on", then (usually) no event will be generated, so your SAR rule won't trigger--i.e., sending an "On" command when the device is already on will not cause an event to be created, so automations that subscribe to this event will not see it.
  • Are you aiming to trigger based on a level change rather than a switch change? If so, that indeed does not appear possible in SAR at the moment (but could definitely be done in RM). But again, I'm still not clear on this since the fact that most Z-Wave drivers match the Z-Wave spec and top level out at 99 shouldn't be different from on/off with any other device.

Maybe some of this will help? :grimacing:

I guess I am not explaining well enough. It is based on level change of the switch. I have tried this 2 ways.

Ex. 1

A. My daytime rule is: if the switch is turned ON during certain hours then set the switch to ON. This is fine but the switch shows ON as 99.
B. My nighttime rule is: If the switch is turned ON during late night hours then set the switch to level 15 based on the switch being turned ON. (Only choice for On) Remember the switch was set to 99 during the day. Well the switch at 99 does not appear to be the same thing as ON because the switch never changes the level to 15, it stays at 99.

Ex. 2

A. My daytime rule is: if the switch is turned ON during certain hours then set the switch to 99.
B. My nighttime rule is: If the switch is turned ON (only choice) during late night hours then set the switch to level 15 based on the switch being set earlier at 99. Once again the switch at 99 does not appear to be the same thing as ON because the switch never changes the level to 15, it stays at 99.

So in conclusion:

  1. You set the switch to On during the day, level shows 99 on device page
  2. You turn on switch to set to 15 but it stays at 99
  3. You set the switch to 99 during the day
  4. You turn on switch to set to 15 but again it stays at 99

That would appear to say that 99 and On are different. That's why there needs to be a "Turned On from Level" added. :man_shrugging:

OK, sorry if I'm still not getting this, but is there just a bug that "Turn on and set level" is only turning on and not setting the level? (Even if the bulb is already on, any "set level" should adjust that.) If so, try removing your level value, hitting "Done," going back in, and putting the value back in. There was a bug when this feature was first introduced that was resolved (assuming you're on newish firmware) but requires a re-input of the value like this.

1 Like

Ok, I have deleted and re-created them. I will see if they work the next time. Thanks for the help.