Loratap SS600ZB to ESPHome Automation

Hello,

I have the LoraTap Remote 3 Button SS600ZB and have been able to pair it with my Zigbee coordinator, however so far I have only been able to see the button presses in zha_event which tells me it is working. Have done a bit of digging around, but am unable to find anything relating to either using HA automations or sending the button press events directly to the esphome?

My use case is this… I installed some WS2812B LED’s connected to a Wemos Mini running esphome in my daughters bedroom. The setup has a motion sensor so acts as a night light when it detects movement.

This all works great… but my 7 year old daughter asked if I could add a button to make the LED’s do other light sequences. So of course Dad (me) said no problem, and here I am.

Here’s the esphome code on the Wemos Mini…

substitutions:
  off_hour: '5'

esp8266:
 board: d1_mini
 framework:
  version: recommended

esphome:
  name: esp4-bdrmlights 
  on_boot:
    - light.turn_off:
        id: bdrm_led_lights
        transition_length: 2.5s

status_led:
  pin: GPIO2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "REDACTED"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp4-Bdrmlights Fallback Hotspot"
    password: "REDACTED"

captive_portal:

script:
  - id: turn_off
    mode: restart
    then:
      - delay: 90s
      - light.turn_off:
          id: bdrm_led_lights
          transition_length: 7.5s
      - logger.log: "LED lights are OFF"

binary_sensor:
  - platform: gpio
    pin: D5
    id: bdrm_pir
    name: "Bdrm PIR Sensor"
    device_class: motion
    on_press:
      then:
      - if:
          condition:
            and:
              # If it's night time
              - sun.is_below_horizon:
              - lambda: |-
                  auto hour = id(my_time).now().hour;
                  return hour > 12 || hour < ${off_hour};
          then:
              #Turn on the LED lights
              - light.turn_on:
                  id: bdrm_led_lights
                  brightness: 40%
                  effect: random
              - logger.log: "LED lights are ON"
    on_release:
      - script.execute: turn_off

sun:
  latitude: !secret latitude
  longitude: !secret longitude

time:
  platform: sntp
  id: my_time
  timezone: !secret timezone
  servers: 
    - 0.au.pool.ntp.org
    - 1.au.pool.ntp.org
    - 2.au.pool.ntp.org

  on_time:
  - hours: ${off_hour}
    minutes: 0
    seconds: 0
    then:
    - light.turn_off:
        id: bdrm_led_lights

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D1
    num_leds: 54
    rgb_order: GRB
    name: "FastLED WS2812B Light"
    id: bdrm_led_lights
    default_transition_length: 7.5s
    effects:
      # Use default parameters:
      - random:
      # Customize parameters
      - random:
          name: "My Slow Random Effect"
          transition_length: 30s
          update_interval: 20s
      - addressable_rainbow:
          name: Rainbow Effect With Custom Values
          speed: 10
          width: 50
      - addressable_color_wipe:
      - addressable_color_wipe:
          name: Color Wipe Effect With Custom Values
          colors:
            - red: 100%
              green: 100%
              blue: 100%
              num_leds: 1
            - red: 0%
              green: 0%
              blue: 0%
              num_leds: 1
          add_led_interval: 100ms
          reverse: false

All I want to happen is this… daughter presses button 1, 2, or 3… the button presses translate to one of the effects available on the Wemos Mini. I figure that should be possible, but so far haven’t been able to crack the solution.

Here’s an attempt at an automation… but it doesn’t trigger the lights?

alias: Bedroom Lights
description: ''
trigger:
  - device_id: db6041c525345e87fcf5053d2ed2b666
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: button_2
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: addressable_rainbow
mode: single

Open to ideas, and appreciate any help.

An update…

Turns out the automation below triggers the lights… which is great. Only issue, the lights dont turn off. So any ideas on how to have the lights turn off after 5 minutes would be appreciated.

alias: Bedroom Lights
description: ''
trigger:
  - device_id: db6041c525345e87fcf5053d2ed2b666
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: button_1
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: Rainbow Effect
      brightness_pct: 90
mode: single
alias: Bedroom Lights
description: ''
trigger:
  - device_id: db6041c525345e87fcf5053d2ed2b666
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: button_1
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: Rainbow Effect
      brightness_pct: 90
  - delay: 00:05:00
  - service: light.turn_off
    target:
      entity_id: light.fastled_ws2812b_light
mode: single

Hello Francis,

Great to hear from you, and thank you for the advice. Looks like a great solution.

First thing my daughter asked… there’s 2 more buttons Dad… can the remaining buttons on the Loratap be used to show different lighting effects.

So, silly question… might it be possible for a single automation be used to trigger a different effect depending on the button pressed?

As always, thank you for the help.

Mark

Hi Everyone,

Have an update on progress with the LoraTap buttons. And looking for some advice on how I might improve the setup.

The setup… wemos mini running esphome (code above) and connected to a strip of WS2812B LED’s. The Loratap signal obviously comes in via ZigBee and is captured by Zigbee2MQTT. All good so far.

I created a bunch of automations (see below) to turn on the LED’s based upon a button press from the Loratap. The setup works but it is clunky… very clunky. The wemos mini onboard motion sensor triggers with movement and overrides the Loratap button presses.

I will be the first to admit there are issues with my setup… firstly I am not an expert… second I am sure there has to be a much easier way to architect integration between the Loratap and the wemos mini. I just cannot figure if direct integration would be easier… something like integrating via mqtt, or something like that?

See first reason as to why I am stuck… I am just not experienced enough to figure out the best way to approach things?

Any suggestions appreciated… my daughter has been patient with me, so I’d really like to find a solution :fearful:

Here’s the first automation:

alias: Bedroom Lights - Fast Random
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: f501bb73628ac7c2f2b115de0c19a330
    type: action
    subtype: 3_single
    discovery_id: 0x804b50fffe21cd57 action_3_single
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: Fast Random Effect
      brightness_pct: 100
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    target:
      entity_id: light.fastled_ws2812b_light
mode: single

And here’s the second automation:

alias: Bedroom Lights - Fireworks
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: f501bb73628ac7c2f2b115de0c19a330
    type: action
    subtype: 2_single
    discovery_id: 0x804b50fffe21cd57 action_2_single
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: Fireworks Effect
      brightness_pct: 100
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    target:
      entity_id: light.fastled_ws2812b_light
mode: single

And the third automation:

alias: Bedroom Lights - Rainbow
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: f501bb73628ac7c2f2b115de0c19a330
    type: action
    subtype: 1_single
    discovery_id: 0x804b50fffe21cd57 action_1_single
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.fastled_ws2812b_light
    data:
      effect: Rainbow Effect
      brightness_pct: 90
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    target:
      entity_id: light.fastled_ws2812b_light
mode: single