Inovelli LED pattern when raining

I created an automation to run a LED notification on a inovelli blue switch when raining using ZHA. It works but ram usage on home assistant grows the long it runs. I also have versions of this for snow and lighting.

This will also dims/brighten the LEDs when the switch is turned on/off.

It also has conditions not to run when my garage door is open or basement sensor detects water. I did this to prevent this from running when other automatons I created are running.

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
              enabled: true
            - 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
          enabled: true
      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
        - delay:
            hours: 0
            minutes: 0
            seconds: 1
            milliseconds: 0
mode: single
'''
1 Like

I can see this chewing into resources real quickly. You’re repeating an automation once per second on an infinite loop while it rains.

The falling and rising effects were both added into the firmware in v2.03 for the purpose of creating a “raining” effect.

I see them in the beta drivers for z2m as well as hubitat.

slow_falling: 9,
medium_falling: 10,
fast_falling: 11,
slow_rising: 12,
medium_rising: 13,
fast_rising: 14,

But they don’t seem to have made it to the latest release yet, and I don’t see them in ZHA either. I would expect once 2.11 is ready to go that it’ll all get pushed out together.

2 Likes

They’re in ZHA, just need to do a Device Action in the automation and you should see them there. If not, may just need to update HA?

For the original issue, @bheberling001 I would agree with @MRobi that you shouldn’t repeat the automation but it would be better to change the effect duration to indefinite and then send a notification to clear the effect once it’s no longer rainy/pouring?

I agree with you on not using the repeat. but I haven’t figured out a good way to get the LED to adjust brightness with switch state without it.

Oh, I think I get what you mean…if you turn the light on/off during, the level isn’t going to change to match the expected behavior?

I think the way to do this would be to trigger off a state change from the light switch(es) themselves as well, and then depending on weather state you would send the updated effect command. So that any time the weather changes, you’ll activate/clear the effect, or if a switch turns on/off, it’ll check the same conditions to update the effect if it’s on.

correct, Basically I am trying to replicate the default function of the switch. where the LED is one brightness when the switch is on and another when the switch is off.

As for the trigger states that sounds like it would work. I unfortunately don’t know what to write that properly. I might have time over the weekend to play with it and see what I can come up with.

You are correct. I was looking at the beta repo not the production repo :man_facepalming:
Interestingly, with z2m, I don’t have the effect listed unless I load a custom converter. But I do see it listed in the zigbee-herdsman-converters repo. I assume it just hasn’t rolled into the HA addon version yet.

2 Likes

I can’t test since I’m on z2m, but this should get you pointed in the right direction. You’ll need to adjust the triggers to fit your device.

What this uses for triggers are pressing up on the switch and pressing down on the switch. You’ll have your conditions listed so it must be NOT raining, garage open (I assume you want the opposite of all this but I just copied conditions from your original automation). Then your actions are based on if the up or down button is pressed.

alias: Switch LED Rain
description: ""
mode: single
trigger:
  - platform: device
    domain: mqtt
    device_id: 4ec9a5405f64a8c5b37d36018e065288
    type: action
    subtype: up_single
    discovery_id: 0x040d84fffe05f961 action_up_single
    id: switch_on
  - platform: device
    domain: mqtt
    device_id: 4ec9a5405f64a8c5b37d36018e065288
    type: action
    subtype: down_single
    discovery_id: 0x040d84fffe05f961 action_down_single
    id: switch_off
condition:
  - condition: or
    conditions:
      - condition: not
        conditions:
          - condition: state
            entity_id: weather.openweathermap
            state: rainy
          - condition: state
            entity_id: weather.openweathermap
            state: pouring
        enabled: true
      - 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
    enabled: true
action:
  - if:
      - condition: trigger
        id: switch_on
    then:
      - type: issue_all_led_effect
        domain: zha
        device_id: 4ec9a5405f64a8c5b37d36018e065288
        effect_type: Slow_Falling
        color: 170
        level: 33
        duration: 255
  - if:
      - condition: trigger
        id: switch_off
    then:
      - type: issue_all_led_effect
        domain: zha
        device_id: 4ec9a5405f64a8c5b37d36018e065288
        effect_type: Slow_Falling
        color: 170
        level: 3
        duration: 1
'''
1 Like

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
2 Likes

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

The goal will be to replace switches all over the house with these. I 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.

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)
2 Likes

If you are using any sort of Android TV in your home, check out PIPup. There are a few custom versions on the HA community forum that will let you have a popup window displaying a live feed of your doorbell camera when a person is detected. I don’t believe there is an AppleTV alternative yet.

I actually already have that for my office TV using a chrome-cast when someone rings the doorbell. I don’t know if I would want it for just person detection.

1 Like