Lighting Automation Routine

One of the consistent challenges I have faced with trying to create automation scripts has been understanding all the different attributes that are available with a specific device. I recently bought a GE Z-Wave Plus Smart Lighting Control Light Dimmer Switch and I am trying to figure out all the attributes that can be used or included in the switch. The documentation I have found hasn’t helped in identifying how I can use the dimmers capability.

Looking at HA’s state information I can see there are two entities available (ge and zwave). My questions are:

  1. Is this the way others determine what attributes can be used when automating new entities / devices or is there documentation I am just not finding?

  2. Can you tell what attribute I should be using to help set the dimmer level?

Below you can see two different “lights”. Lights are dimmable devices. Switches are non-dimmable devices. Below you can see the top device is off and doesn’t give you any information about brightness. The second device is on and shows a brightness of 67. Your automations should check to see if the device state is on. If it is on, then it can adjust the device. If it’s state is off, then the brightness cannot be adjusted. Makes sense since the light is off. But what this also means is that you can’t adjust the initial brightness of the device. You have to turn it on before the brightness can be adjusted.

The zwave device is used to access attributes that are not exposed as a device. For example, multi sensor devices like the Zooz 4 in 1 sensor, do not provide a battery_level sensor. You have to setup a template for battery_level and extract it from the zwave device to get it. That is the only case where I have had to use the zwave device. All other automations I have use the devices created when the device joins the zwave network.

The other thing you can check with a light is its supported_features attribute. This really isn’t documented (AFAIK), but this attribute contains “bit fields” that indicate what features the light supports. You have to convert the value to binary, and compare it against the list of possible values, which you can see here.

So, e.g., your light’s supported_features is 1, which means that it only supports setting brightness, which you do via the light.turn_on service with the brightness or brightness_pct parameter.

I appreciate all the feedback that you guys have provided!

I’m trying to setup an automation that will turn on the light between 11:50:00AM and 11:55:00AM with a brightness percentage of 15. For some reason, I have messed up the automation because it never turned on the light between that timeframe. Where did I go wrong?

- alias: "Night Light Routine"
  trigger:
    platform: state
    entity_id: light.ge_14294_inwall_smart_dimmer_level
    to: 'on'
    from: 'off'
  condition:
    condition: time
    after: '11:50:00'
    before: '11:55:00'
  action:
    - service: light.turn_on
      data:
        entity_id: light.ge_14294_inwall_smart_dimmer_level
        brightness_pct: 15

Thanks again for all the help!

The automation your wrote here will change the brightness of the dimmer to 15% when it is turned on some other way between 11:50 and 11:55. Is that what you want? Or do you want the automation to turn the dimmer on to 15% at 11:50?

I’d like to have the light turn on at 11:50:00 with a brightness of 15% and then turn off at 11:55:00.

The easiest (although maybe not the best) way to do that is with something like this:

- alias: Night Light Routine
  trigger:
    platform: time
    at: '11:50:00'
  action:
    - service: light.turn_on
      entity_id: light.ge_14294_inwall_smart_dimmer_level
      data:
        brightness_pct: 15
    - delay: '00:05:00'
    - service: light.turn_off
      entity_id: light.ge_14294_inwall_smart_dimmer_level

Really appreciate all the help! That worked.

I tried to that script one step further to create a morning light routine where the light comes on at 6:20 AM every weekday. It appears I have misinterpreted the conditions documentation.

Any thoughts on what I botched up?

- alias: Morning Light Routine
  condition:
    conditions:
      - condition: time
        at: '06:20:00'
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
  action:
    - service: light.turn_on
      entity_id: light.ge_14294_inwall_smart_dimmer_level
      data:
        brightness_pct: 50
    - delay: '00:25:00'
    - service: light.turn_off
      entity_id: light.ge_14294_inwall_smart_dimmer_level

A couple problems. First, your automation has no trigger. The trigger is what decides when the actions will run. Every automation has to have at least one trigger. The condition(s), on the other hand, decide if the actions will run (when a trigger fires.)

The second problem is your condition section isn’t formed correctly.

What you want is this:

- alias: Morning Light Routine
  trigger:
    platform: time
    at: '06:20:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: light.turn_on
      entity_id: light.ge_14294_inwall_smart_dimmer_level
      data:
        brightness_pct: 50
    - delay: '00:25:00'
    - service: light.turn_off
      entity_id: light.ge_14294_inwall_smart_dimmer_level

Thanks @pnbruckner!

Big oversight on my part with the trigger.

The conditions part is interesting because I was using the Conditions documentation. This section specifically around two conditions:

I guess I thought there were two conditions that needed to be satisfied before the actions took place (i.e the time and day had to be satisfied).

Thanks again.

Even so, you missed the “condition: and” line. :slight_smile: