Best practices for changing LEDs for an event and then returning to default

I’m curious how you all manage the LED bars. Changing to a new color and intensity is pretty straightforward, but I haven’t found a “return to default” method yet other than a hardcoding the default settings in a command. And if the LED changes should be across many switches, it means hardcoding the default color for all of them separately.

A couple use cases I’m thinking about as they may have a different approach to them:

  1. Turn LED on several switches yellow if the garage door is open. Return to default when it is closed.
  2. Turn LED on the same several switches purple if it’s garbage day and I haven’t marked there task as Done yet (via an input helper). Return to default when it marked done or the day is over.
  3. Change the LED to red in my baby’s room if “sleep mode” (via an input helper) is on, and revert to default when sleep mode is off
  4. If the light color in my daughter’s room is not one of the default colors (ie she wants to make it blue temporarily for some reason) the LED would change to match the light color until it goes back to one of the normal light color modes, at which point the LED returns to default (purple)

A few questions that might help guide the advice I’m hoping to receive:

  1. Should I change the LED color or use an effect?
  2. How should I best store the default settings for each switch? Is there a way to change the LED but return to the default I’ve set in the switch configuration?
  3. Best way to group switches so I don’t have to manually add the ones I want to my automations (eg 1 and 2 above)

My setup:

  • red series (zwave) and blue series (Zigbee) switches
  • home assistant using zwave js and zigbee2mqtt
  • aeotec zwave controller and sonoff Zigbee controller
  • for my few smart lights, they are Innr bulbs

Not sure how this shakes out in HA, but the general concept is that the short term things are set as notifications. When that notification event is over, you turn off the notification, and the LED bar goes back to the default.

1 Like

@Bry by “notification”, are you referring to the “LED effect” (something like the below in Z2M in HA)?

Yes, I have the same four components in ST.

ok cool. that definitely simplifies things for me, as I don’t need to store the default state in multiple places. I’m not sure why I didn’t use that before…but i’ve just tested with some of my automations and it’s working great!

1 Like

I have something similar set up in HA using zha.

The Blue switches at each exit door and my MBR are set to the effect “Chase” (color red) anytime my binary sensor “House Secure” is off.

House Secure is off anytime an outside door is unlocked (kwikset zwave lock), an outside door is not fully closed (Ring alarm door sensors), or a garage door is open (MyQ) . I did this via a value sensor counting entities within each defined group in the unwanted state. House Secure is on when sum of those three values is 0 and off if >0. I only learned how to do these things this week. Wasn’t too hard.

I also have another binary switch to enable / disable the visual warnings… E. G. When guests are visiting or we are entertaining and leaving doors unlocked / open intentionally no need for the switches to all be chasing red like Kitt’s grille. I have a daily automation to reset that warning toggle back to enabled at 10pm and again at midnight so that we always know if the house is secure when we are going to bed even if we had disabled the warnings earlier.

Anyway, from my automation yaml, it seems there is a ‘Clear’ effect which just returns the switch back to normal. I actually had forgotten that when I first read your question. For me, this happens either when the House Secure goes back to the On state or if the warning switch is turned off to temporarily block the warnings.

Finally, I couldn’t find a way to create a switch group to send the effect to all at once, so I just made the action in my automation set the effect individually for the four switches that I wanted to show the warning.

Edit -
See screenshot below for one of my clear actions. I’m pretty sure the color level in duration are not relevant for the clear effect because it just brings mine back to their default settings.

2 Likes

that’s really helpful, thanks! confirms and clarifies a few things for me. i like the idea of “house secure” … i don’t have many door sensors yet, but it would be smart to build what you described now and it will be easy to add devices later!

that zha call to clear the led effect is really nice! with Z2m I have to literally write the message payload and publish an MQTT message. I wish there was a way to do it more easily like the UI you showed :frowning:

As I typed this out I realized my solution feels complicated but it’s very powerful once you understand how it works it requires very little maintenance (only when you want to add a new warning; nothing changes for new devices).

  • I use an input_select to track what the LEDs in an area are currently set to,
  • a template sensor to track what they should be set to,
  • a script to evaluate the sensors and figure out which effects, colors, and brightnesses to use,
  • and a final script to identify all Inovelli dimmers, switches, and fan / light combos in an area and set their LEDs.
  1. As a general principal I like to use the LED color for “cleared” / “normal” state, which changes from red at night to blue during the day, and effects are for warnings. They catch peoples’ attention and even guests know something is wrong.

  2. I use a combination of template sensors and input_selects.

  3. I use “areas” instead of groups. When a device is added to an area, it automatically gets the color and effect settings for that area without changing any scripts or automations.

Here are some snippets to show how it works. First, a template sensor to determine what I want an area to be:

  - name: "Garage Door Status Should be Set to"
    state: >
      {# Garbage day, but not done #}
      {% if is_state('binary_sensor.garbage_day', 'on') and
            is_state('binary_sensor.garbage_out','on') %}
         Garbage
      {# It's cold / hot outside / thermostat is auto / heat / cool; close the dang door! #}
      {% elif is_state('binary_sensor.garage_door', 'on') and
              (float(states('sensor.current_temp_outside'), default=0) < 50.0 or
              float(states('sensor.current_temp_outside'), default=0) >= 85.0) or 
              not is_state('climate.ecobee3_kitchen', 'off') %}
        Thermal
      {# prevents lights from timing out and turning off and locks from locking since I have no motion sensor in the garage #}
      {% elif is_state('input_boolean.garage_in_use', 'on') %}
        In Use
      {% elif is_state('input_select.goodnight', 'Started') and
              is_state('input_boolean.outside_rear_in_use', 'off') %}
        Goodnight
        {# We're shutting it down and locking it up.  Get out. #}
      {% else %}
        Clear
      {% endif %}

An input select template tracks the status of the door:

garage_door_status_is:
  name: Garage House Door Status Is
  options:
    - Clear
    - Thermal           # Covers hot or cold outside as well as the EcoBee on
    - Laundry           # Laundry is done
    - "In Use"          # Warning that garage side door won't lock
    - Goodnight         # Sets the goodnight alerts if nothing else needs to be displayed.

From there, a simple automation can track any state change to sensor.garage_door_status_should_be_set_to and call a script. I also track the “status_is” sensors, so I can manually set them to clear if I want and things take care of themselves. The automation for my downstairs warnings looks like:

alias: Inovelli Downstairs Warnings
description: >-
  Handles Inovelli effects for events like open doors, areas in use, disabled
  locks or lighting controls, and so on.  
trigger:
  - platform: state
    entity_id: sensor.front_door_status_should_be
    id: Front Door Status Should Be
  - platform: state
    entity_id: sensor.garage_house_door_status_should_be
    id: Garage Door Status Should Be
  - platform: state
    entity_id: sensor.sliding_glass_door_status_should_be
    id: Sliding Glass Door Status Should Be
  - platform: state
    entity_id: input_select.front_door_status_is
    id: Front Door Status Is
  - platform: state
    entity_id: input_select.garage_house_door_status_is
    id: Garage Door Status Is
  - platform: state
    entity_id: input_select.sliding_glass_door_status_is
    id: Sliding Glass Door Status Is
condition:
  - condition: or
    conditions:
      - condition: template
        value_template: >-
          {{ states('sensor.front_door_status_should_be') !=
          states('input_select.front_door_status_is') }}
      - condition: template
        value_template: >-
          {{ states('sensor.garage_house_door_status_should_be') !=
          states('input_select.garage_house_door_status_is') }}
      - condition: template
        value_template: >-
          {{ states('sensor.sliding_glass_door_status_should_be') !=
          states('input_select.sliding_glass_door_status_is') }}
action:
  - service: script.inovelli_downstairs_warnings
    data: {}
mode: queued
max: 10

The script.inovelli_downstairs_warnings script is a series of choose services, one for each area, in order to determine what needs to change.


      - service: script.inovelli_led_zwavejs
        data_template:
          area: garage
          color: |
            {% if is_state('sensor.garage_door_status_should_be', 'Thermal') %}
              Red
            {% elif is_state('sensor.garage_door_status_should_be', 'In Use') %}
              Green
            {% elif is_state('sensor.garage_door_status_should_be', 'Laundry') %}
              Purple
            {% elif is_state('sensor.garage_door_status_should_be', 'Goodnight') %}
              Red
            {% elif is_state('sensor.garage_door_status_should_be', 'Clear') %}
              Off
            {% endif %}
          duration: |
            {% if is_state('sensor.garage_door_status_should_be', 'Clear') %}
              Off
            {% else %}
              Forever
            {% endif %}
          effect: |
            {% if is_state('sensor.garage_door_status_should_be', 'Thermal') %}
              Fast Blink
            {% elif is_state('sensor.garage_door_status_should_be', 'In Use') %}
              Pulse
            {% elif is_state('sensor.garage_door_status_should_be', 'Laundry') %}
              Pulse
            {% elif is_state('sensor.garage_door_status_should_be', 'Goodnight') %}
              Chase
            {% elif is_state('sensor.garage_door_status_should_be', 'Clear') %}
              Off
            {% endif %}
          brightness: 6

My script for setting colors and effects on Inovelli Red series devices will take an “area”, identify the appropriate entities, and update them in the appropriate service calls. There’s no need to tell it what type of devices or list the entities.

1 Like