Inovelli LED pattern when raining

I created an automation to run a LED notification on a inovelli blue switch when raining. It works but ram usage on home assistant grows the long it runs.

alias: Switch LED Rain
description: ""
trigger:
  - platform: state
    entity_id:
      - weather.openweathermap
    to: rainy
  - platform: state
    entity_id:
      - weather.openweathermap
    to: pouring
condition: []
action:
  - repeat:
      until:
        - condition: or
          conditions:
            - condition: not
              conditions:
                - condition: state
                  entity_id: weather.openweathermap
                  state: rainy
                - condition: state
                  entity_id: weather.openweathermap
                  state: pouring
            - condition: device
              device_id: 1f7f702209288990261a36ae50ec664b
              domain: cover
              entity_id: cover.garage_door
              type: is_open
            - type: is_moist
              condition: device
              device_id: 300cd8abc7839eb15d013cd250050eec
              entity_id: binary_sensor.basement_water_sensor_iaszone
              domain: binary_sensor
      sequence:
        - if:
            - condition: device
              type: is_on
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              entity_id: light.office_switch_light
              domain: light
          then:
            - type: issue_all_led_effect
              domain: zha
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              effect_type: Slow_Chase
              color: 170
              level: 33
              duration: 1
          else:
            - type: issue_all_led_effect
              domain: zha
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              effect_type: Slow_Chase
              color: 170
              level: 3
              duration: 1
mode: single

Why are you repeating?
That automation is running all the time, really all the time.

Instead you can just trigger from: pouring and another from: rainy.
Then if that triggers turn off the light or whatever you want when it’s raining.

Or actually use a template:

{{ states('weather.openweathermap') not in ['pouring', 'rainy'] }} 

I believe something like this could work.
I have not added the basement sensor, don’t know what the other state is, is_dry?
That needs to be added as a trigger with trigger id no_rain also.

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - weather.openweathermap
    to: rainy
    id: rain
  - platform: state
    entity_id:
      - weather.openweathermap
    to: pouring
    id: rain
  - platform: template
    value_template: "{{ states('weather.openweathermap') not in ['pouring', 'rainy'] }} "
    id: no_rain
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: is_closed
    id: no_rain
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: rain
          - condition: device
            device_id: 1f7f702209288990261a36ae50ec664b
            domain: cover
            entity_id: cover.garage_door
            type: is_open
          - type: is_moist
            condition: device
            device_id: 300cd8abc7839eb15d013cd250050eec
            entity_id: binary_sensor.basement_water_sensor_iaszone
            domain: binary_sensor
        sequence:
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Slow_Chase
            color: 170
            level: 33
            duration: 1
      - conditions:
          - condition: trigger
            id: no_rain
        sequence:
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Slow_Chase
            color: 170
            level: 3
            duration: 1

The repeating allows for the changing of the LED brightness if the switch is turned on/off while it is running.

So does my example above. No need to loop.

The basement sensor and garage door conditions are there to prevent this automation from running over other automatons that are more important.

The two light sequences are both for rain. One is just brighter for when the switch is on. Hence why I use repeat.

If there is away around the repeat function thee “no_rain” condition would be to stop the LED effect.

This shouldn’t be an issue. I believe your way of automating is recourse heavy and that is why you need to do this.
Normal automations does not have this issue.
Home Assistant is state based which means it’s very light weight if used properly.

Not only does your automation run all the time, I mean every millisecond but also it blasts out in the ZigBee network a new command.

So if both is for rain, are you expecting it to rain all the time? What will happen when it doesn’t rain?

Tell us what you want to happen and when and we can help you out.

Gotcha.

When it stops raining I want the LED to do nothing. Inovelli switches have a default LED color and brightness it will go to when the automation stops.

The “level: 33” brightness is for if the switch is on and the “level: 3” is for when the switch is off.
That effectively gives the LED auto dimming when the light in the room is turned on and off while running.

Also would it be better to move the garage door and basement sensor to the “contitions” as a “condition: not”

Ok… So what happens if you change the duration to lets say 60? Does it run for 60 seconds then?
What happens if you remove the duration? Does it go on forever?

Didn’t you just say you didn’t need them in the automation? Are these or not part of this automation?

60 is 60 seconds, 0 is invalid, and 255 is forever

I do need those conditions for the garage door and basement sensor that way this automation doesn’t play over another.

For example if the basement sensor detects water (i.e flooding) I want to make sure that automation for the LEDs is what runs.

Post both automations then.
If we use 255 as the value and only change the state of the LED when needed then nothing will collide.
But I need to know what the other actions are

Those automatons will need to be reworded as well but I can do that once I have this one fixed.

Garage door LED

alias: Switch LED Garage Door
description: ""
trigger:
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: opened
condition: []
action:
  - repeat:
      until:
        - condition: not
          conditions:
            - condition: device
              device_id: 1f7f702209288990261a36ae50ec664b
              domain: cover
              entity_id: cover.garage_door
              type: is_open
      sequence:
        - if:
            - condition: device
              type: is_on
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              entity_id: light.office_switch_light
              domain: light
          then:
            - type: issue_all_led_effect
              domain: zha
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              effect_type: Aurora
              level: 33
              duration: 1
              color: 200
          else:
            - type: issue_all_led_effect
              domain: zha
              device_id: 4ec9a5405f64a8c5b37d36018e065288
              duration: 1
              level: 3
              color: 200
              effect_type: Aurora
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
mode: single

Basement water detection

alias: Water detected in basement
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.basement_water_sensor_iaszone
    for:
      hours: 0
      minutes: 0
      seconds: 5
    to: "on"
condition: []
action:
  - device_id: 7c8e66ec441be5978d5dec6bd0772523
    domain: mobile_app
    type: notify
    message: Water detected in basement
  - service: tts.google_translate_say
    data:
      cache: false
      entity_id: media_player.home_audio
      message: Water detected in basement
  - repeat:
      until:
        - condition: state
          entity_id: binary_sensor.basement_water_sensor_iaszone
          state: "off"
      sequence:
        - type: issue_all_led_effect
          domain: zha
          device_id: 4ec9a5405f64a8c5b37d36018e065288
          effect_type: Fast_Siren
          level: 100
          duration: 1
          color: 170
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
mode: single

This is untested and I added snow and lighting.

alias: Switch LED Weather
description: ""
trigger:
  - platform: state
    entity_id:
      - weather.openweathermap
  - platform: state
    entity_id:
      - light.office_switch_light
condition:
  - condition: not
    conditions:
      - type: is_moist
        condition: device
        device_id: 300cd8abc7839eb15d013cd250050eec
        entity_id: binary_sensor.basement_water_sensor_iaszone
        domain: binary_sensor
      - condition: device
        device_id: 1f7f702209288990261a36ae50ec664b
        domain: cover
        entity_id: cover.garage_door
        type: is_open
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: rainy
              - condition: state
                entity_id: weather.openweathermap
                state: pouring
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 170
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 170
                level: 3
                duration: 255
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: snowy
              - condition: state
                entity_id: weather.openweathermap
                state: snowy-rainy
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 255
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 255
                level: 3
                duration: 255
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: lightning
              - condition: state
                entity_id: weather.openweathermap
                state: lightning-rainy
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Chase
                color: 8
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Chase
                color: 8
                level: 3
                duration: 255
    default:
      - type: issue_all_led_effect
        domain: zha
        device_id: 4ec9a5405f64a8c5b37d36018e065288
        effect_type: Clear
        color: 170
        level: 3
        duration: 1
mode: single

I believe I got it all here.
This gives priority to water leak sensor. All other actions have water leak sensor as a condition to not interrupt the fast siren effect.

description: ""
mode: single
trigger:
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: opened
    id: garage_opened
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: closed
    id: garage_closed
  - platform: state
    entity_id: weather.openweathermap
    id: weather
  - platform: state
    entity_id:
      - binary_sensor.basement_water_sensor_iaszone
    for:
      hours: 0
      minutes: 0
      seconds: 5
    to: "on"
    id: water
  - platform: state
    entity_id:
      - binary_sensor.basement_water_sensor_iaszone
    for:
      hours: 0
      minutes: 0
      seconds: 5
    to: "off"
    id: no_water
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: garage_opened
          - condition: not
            conditions:
              - type: is_moist
                condition: device
                device_id: 300cd8abc7839eb15d013cd250050eec
                entity_id: binary_sensor.basement_water_sensor_iaszone
                domain: binary_sensor
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Aurora
                level: 33
                duration: 255
                color: 200
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                duration: 255
                level: 3
                color: 200
                effect_type: Aurora
      - conditions:
          - condition: trigger
            id: garage_closed
          - condition: not
            conditions:
              - type: is_moist
                condition: device
                device_id: 300cd8abc7839eb15d013cd250050eec
                entity_id: binary_sensor.basement_water_sensor_iaszone
                domain: binary_sensor
        sequence:
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            duration: 255
            level: 3
            color: 200
            effect_type: Aurora
      - conditions:
          - condition: trigger
            id: weather
          - condition: template
            value_template: "{{states('weather.openweathermap') not in ['pouring', 'rainy']}} "
          - condition: not
            conditions:
              - type: is_moist
                condition: device
                device_id: 300cd8abc7839eb15d013cd250050eec
                entity_id: binary_sensor.basement_water_sensor_iaszone
                domain: binary_sensor
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                level: 33
                duration: 255
                color: 170
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                duration: 255
                level: 3
                color: 170
                effect_type: Slow_Falling
      - conditions:
          - condition: trigger
            id: weather
          - condition: template
            value_template: >-
              {{states('weather.openweathermap') not in ['snowy',
              'snowy-rainy']}} 
          - condition: not
            conditions:
              - type: is_moist
                condition: device
                device_id: 300cd8abc7839eb15d013cd250050eec
                entity_id: binary_sensor.basement_water_sensor_iaszone
                domain: binary_sensor
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                level: 33
                duration: 255
                color: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                duration: 255
                level: 3
                color: 255
                effect_type: Slow_Falling
      - conditions:
          - condition: trigger
            id: weather
          - condition: template
            value_template: >-
              {{states('weather.openweathermap') not in ['lightning',
              'lightning-rainy']}} 
          - condition: not
            conditions:
              - type: is_moist
                condition: device
                device_id: 300cd8abc7839eb15d013cd250050eec
                entity_id: binary_sensor.basement_water_sensor_iaszone
                domain: binary_sensor
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Chase
                level: 33
                duration: 255
                color: 8
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                duration: 255
                level: 3
                color: 8
                effect_type: Slow_Chase
      - conditions:
          - condition: trigger
            id: water
        sequence: 
          - device_id: 7c8e66ec441be5978d5dec6bd0772523
            domain: mobile_app
            type: notify
            message: Water detected in basement
          - service: tts.google_translate_say
            data:
              cache: false
              entity_id: media_player.home_audio
              message: Water detected in basement
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Fast_Siren
            level: 100
            duration: 255
            color: 170
      - conditions:
          - condition: trigger
            id: no_water
        sequence: 
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Fast_Siren
            level: 100
            duration: 1
            color: 170

So if garage door is open and the weather changes to raining then rain will be displayed.
You could probably get another layer of priority in there but honestly, is one LED supposed to tell you everything?
Wouldn’t it be easier to use the TTS for water leak and garage door and have the light as the weather thing. After all your not looking at that light all the time are you?

The goal will be to replace switches all over the house with these also I like redundant notifications. I also want the dynamic LED brightness for when I have switches in the bedroom and living room. I don’t want to woken up or distracted by a super bright flashing LED. when the lights are off but I do want to be able to see them if the lights are on.

I believe I have everything working now. there are three automatons.

First is the water sensor (for basement flooding). This sends a push notification to my phone, sends a TTS alert to all google home speakers, and sets the switch LED to a red “siren” pattern at 100% brightness.

alias: Water detected in basement
description: ""
trigger:
  - type: moist
    platform: device
    device_id: 300cd8abc7839eb15d013cd250050eec
    entity_id: binary_sensor.basement_water_sensor_iaszone
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - type: not_moist
    platform: device
    device_id: 300cd8abc7839eb15d013cd250050eec
    entity_id: binary_sensor.basement_water_sensor_iaszone
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - choose:
      - conditions:
          - type: is_moist
            condition: device
            device_id: 300cd8abc7839eb15d013cd250050eec
            entity_id: binary_sensor.basement_water_sensor_iaszone
            domain: binary_sensor
            for:
              hours: 0
              minutes: 0
              seconds: 0
        sequence:
          - device_id: 7c8e66ec441be5978d5dec6bd0772523
            domain: mobile_app
            type: notify
            message: Water detected in basement
          - service: tts.google_translate_say
            data:
              cache: false
              entity_id: media_player.home_audio
              message: Water detected in basement
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Fast_Siren
            color: 1
            level: 100
            duration: 255
      - conditions:
          - type: is_not_moist
            condition: device
            device_id: 300cd8abc7839eb15d013cd250050eec
            entity_id: binary_sensor.basement_water_sensor_iaszone
            domain: binary_sensor
            for:
              hours: 0
              minutes: 0
              seconds: 0
        sequence:
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Clear
            color: 170
            level: 1
            duration: 1
mode: single

Next this the garage door notification. This sets the LED to purple “pulse” pattern and has two brightness’s (If Switch is on it is 33%, If switch is off 1%) and this will change “live”. It also has a condition not to run if the water sensor detects water. so not to over lap the previous automation.

alias: Switch LED Garage Door
description: ""
trigger:
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: opened
  - platform: device
    device_id: 1f7f702209288990261a36ae50ec664b
    domain: cover
    entity_id: cover.garage_door
    type: closed
  - platform: state
    entity_id:
      - light.office_switch_light
condition:
  - condition: not
    conditions:
      - type: is_moist
        condition: device
        device_id: 300cd8abc7839eb15d013cd250050eec
        entity_id: binary_sensor.basement_water_sensor_iaszone
        domain: binary_sensor
action:
  - choose:
      - conditions:
          - condition: device
            device_id: 1f7f702209288990261a36ae50ec664b
            domain: cover
            entity_id: cover.garage_door
            type: is_open
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Pulse
                color: 190
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Pulse
                level: 1
                color: 190
                duration: 255
      - conditions:
          - condition: device
            device_id: 1f7f702209288990261a36ae50ec664b
            domain: cover
            entity_id: cover.garage_door
            type: is_closed
        sequence:
          - type: issue_all_led_effect
            domain: zha
            device_id: 4ec9a5405f64a8c5b37d36018e065288
            effect_type: Clear
            color: 170
            level: 3
            duration: 1
mode: single

Last is the weather LED. This has various colors and patterns based on the current weather condition. It also has the dynamic LED brightness and has conditions not to run if the water sensor detects water or if the garage door is opened.

alias: Switch LED Weather
description: ""
trigger:
  - platform: state
    entity_id:
      - weather.openweathermap
  - platform: state
    entity_id:
      - light.office_switch_light
condition:
  - condition: not
    conditions:
      - type: is_moist
        condition: device
        device_id: 300cd8abc7839eb15d013cd250050eec
        entity_id: binary_sensor.basement_water_sensor_iaszone
        domain: binary_sensor
      - condition: device
        device_id: 1f7f702209288990261a36ae50ec664b
        domain: cover
        entity_id: cover.garage_door
        type: is_open
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: rainy
              - condition: state
                entity_id: weather.openweathermap
                state: pouring
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 170
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 170
                level: 1
                duration: 255
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: snowy
              - condition: state
                entity_id: weather.openweathermap
                state: snowy-rainy
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 255
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Falling
                color: 255
                level: 1
                duration: 255
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.openweathermap
                state: lightning
              - condition: state
                entity_id: weather.openweathermap
                state: lightning-rainy
        sequence:
          - if:
              - condition: device
                type: is_on
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                entity_id: light.office_switch_light
                domain: light
            then:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Chase
                color: 8
                level: 33
                duration: 255
            else:
              - type: issue_all_led_effect
                domain: zha
                device_id: 4ec9a5405f64a8c5b37d36018e065288
                effect_type: Slow_Chase
                color: 8
                level: 1
                duration: 255
    default:
      - type: issue_all_led_effect
        domain: zha
        device_id: 4ec9a5405f64a8c5b37d36018e065288
        effect_type: Clear
        color: 170
        level: 1
        duration: 1
mode: single

I also have plans to add more in the future. my current plans are to add

  • person detected at front door (I have a nest doorbell)
  • If security system is armed (this would only be on switches next the exterior doors to prevent me form accidentally setting off the alarm)
  • More severe weather conditions (Tornado warning, winter weather advisory, severe cold/heat, etc)