ZHA - Lidl/Livarnolux/Tuya/Silvercrest 4 button remote

blueprint:
  source_url: https://github.com/Damian666/HomeAssistant/blob/main/blueprints/automation/Damian666/Lidl_4Button_Remote_Switch.yaml
  name: ZHA - Lidl 4 Button Remote Switch
  description: Automate your Lidl/LivarnoLux 4 Button Remote Switch using ZHA events.
  domain: automation

  input:
    Lidl_4Button_Remote:
      name: Lidl 4Button Remote
      description: Select the Lidl 4 Button Remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TYZB01_bngwdjsr
          model: TS1001
          multiple: false
    button_one_short_press:
      name: Single Press
      description: Action to run on button 1 (OFF/0) single press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press
      description: Action to run on button 2 (ON/1) single press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press
      description: Action to run on button 3 (Bright) single press
      default: []
      selector:
        action: {}
    button_four_short_press:
      name: Single Press
      description: Action to run on button 4 (Dim) single press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'Lidl_4Button_Remote'
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    args: '{{ trigger.event.data.args }}'
    stepmode: '{{trigger.event.data.params.step_mode}}'
- choose:
  - conditions: '{{ command == ''off'' }}'
    sequence: !input 'button_one_short_press'
  - conditions: '{{ command == ''on'' }}'
    sequence: !input 'button_two_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Up'' }}'
    sequence: !input 'button_three_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Down'' }}'
    sequence: !input 'button_four_short_press'

image

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

For everyone that just like me bought the Lidl starter set, but ditched the gateway.

This blueprint enables us to use the remote again with ZHA

Please let me know if there are issues, or stuff I could do better code wise :wink:

3 Likes

Hey Damian. I was about to share my blueprint and then saw yours. Good work! You’re missing out on 2 options, which are longpress_plus and longpress_minus (longpresses on buttons ON/OFF dont do anything). Add them and you have a solid blueprint. I also advice you to share the complete code in your 1st post and adding Tuya and Silvercrest to the name or description. Keep up the good work!!

The pieces of code that could be added (for more functionality):

#under input:
    longpress_plus_action:
      name: Longpress +
      description: Action to run when + is longpressed
      default: []
      selector:
        action: {}
    longpress_minus_action:
      name: Longpress -
      description: Action to run when - is longpressed
      default: []
      selector:
        action: {}

and…

variables:
  ...
  longpress_plus_action: !input "longpress_plus_action"
  longpress_minus_action: !input "longpress_minus_action"

aaand under actions:

      - conditions:
          - '{{ command == "step" }}'
          - "{{ args == [1, 51, 10] }}"
        sequence: !input "minus_action"
      - conditions:
          - '{{ command == "move" }}'
          - "{{ args == [0, 51,] }}"
        sequence: !input "longpress_plus_action"
      - conditions:
          - '{{ command == "move" }}'
          - "{{ args == [1, 51,] }}"
        sequence: !input "longpress_minus_action"```
1 Like

yea, i did not get that far yet, nice man. ill add it :slight_smile:

1 Like

this blueprint doesnt work for me - only buttons 1 and 2 function. buttons 3 and 4 dont function at all

the args parsing just wasn’t working at all for me so only the main buttons worked. This revised version works for me - it uses a new variable ‘stepmode’ to pull out the actions. Incidentally the strings ‘StepMode.Up’’ and ‘‘StepMode.Down’’ are not visible when viewing the zha_event in dev tools. I only spotted them when closely examing the trace

blueprint:
  name: ZHA - Lidl 4 Button Remote
  description: Automate your Lidl 4 Button Remote using ZHA events.
  domain: automation
  input:
    Lidl_4Button_Remote:
      name: Lidl 4Button Remote
      description: Select the Lidl 4 Button Remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TYZB01_bngwdjsr
          model: TS1001
          multiple: false
    button_one_short_press:
      name: Single Press
      description: Action to run on button 1 (OFF/0) single press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press
      description: Action to run on button 2 (ON/1) single press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press
      description: Action to run on button 3 (Bright) single press
      default: []
      selector:
        action: {}
    button_four_short_press:
      name: Single Press
      description: Action to run on button 4 (Dim) single press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'Lidl_4Button_Remote'
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    args: '{{ trigger.event.data.args }}'
    stepmode: '{{trigger.event.data.params.step_mode}}'
- choose:
  - conditions: '{{ command == ''off'' }}'
    sequence: !input 'button_one_short_press'
  - conditions: '{{ command == ''on'' }}'
    sequence: !input 'button_two_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Up'' }}'
    sequence: !input 'button_three_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Down'' }}'
    sequence: !input 'button_four_short_press'
    

There are two other “commands” stop and move which I’m going to add support for but not at 1:52 am.

Hope this is useful. credit to original author.

More presses would be available if the quirck gets an update to report the repeated presses on the ON buttion.

I hope u are still alive and well Tachikoma :smiley: It’s been a while since that 1:52 :grin:

The one that u are referring to is the MoveMode for buttons 3 and 4 when longpressing them.
Add the following to make the blueprint more complete:

under input...
    button_three_long_press:
      name: B3 Long Press
      description: Action to run on button 3 (Bright) longpress
      default: []
      selector:
        action: {}
    button_four_long_press:
      name: B4 Long Press
      description: Action to run on button 4 (Dim) longpress
      default: []
      selector:
        action: {}

under variables...
    movemode: '{{trigger.event.data.params.move_mode}}'

under choose...  
  - conditions: '{{  command == ''move'' and movemode == ''MoveMode.Up'' }}'
    sequence: !input 'button_three_long_press'
  - conditions: '{{  command == ''move'' and movemode == ''MoveMode.Down'' }}'
    sequence: !input 'button_four_long_press'

cheers for the update :slight_smile:

Thanks for this nice automation. I was looking for it because I removed my LIDL hub and exchanged it with the Conbee II stick. However… the blueprint doesn’t work for me. I imported it and connected the automation for the LIDL remote and one bulb. Not any of the buttons shows a reaction. How can I check what’s wrong with my settings?

Edit: I reconnected the remote by pushing 0 and 1 for about 5 seconds. Now the “on” and “off” automation works again. Dimming is for later.

Thx for this blue print very usefull.

Is it a way to have a script binded to a button ? i’m trying to have this on button 3 (broadlink send command):

alias: TV Power
sequence:
  - service: remote.send_command
    data:
      device: Télé
      command: Power
    target:
      device_id: 137064fa06183da067276f3cb7e872ff
mode: single
icon: mdi:television

So i’ve transpoed it this way :

    button_three_short_press:
      - service: remote.send_command
        data:
          device: Télé
          command: Power
        target:
          device_id: 137064fa06183da067276f3cb7e872ff

Unfortunately no response from my TV. Any hint ?

Edit :

Service call’s working fine if you edit yaml for this blue print w/ the ones from @tachikoma1373 & @mo-harry (thx to them ! and of course @DamianQuest for this usefull blue print) to enable buttons 3 & 4

for the lazy ones who do not wanna edit by themselves here is the yaml i’ve used

blueprint:
  name: ZHA - Lidl 4 Button Remote
  description: Automate your Lidl 4 Button Remote using ZHA events.
  domain: automation
  input:
    Lidl_4Button_Remote:
      name: Lidl 4Button Remote
      description: Select the Lidl 4 Button Remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TYZB01_bngwdjsr
          model: TS1001
          multiple: false
    button_one_short_press:
      name: Single Press
      description: Action to run on button 1 (OFF/0) single press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press
      description: Action to run on button 2 (ON/1) single press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press
      description: Action to run on button 3 (Bright) single press
      default: []
      selector:
        action: {}
    button_three_long_press:
      name: B3 Long Press
      description: Action to run on button 3 (Bright) longpress
      default: []
      selector:
        action: {}    
    button_four_short_press:
      name: Single Press
      description: Action to run on button 4 (Dim) single press
      default: []
      selector:
        action: {}
    button_four_long_press:
      name: B4 Long Press
      description: Action to run on button 4 (Dim) longpress
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'Lidl_4Button_Remote'
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    args: '{{ trigger.event.data.args }}'
    stepmode: '{{trigger.event.data.params.step_mode}}'
    movemode: '{{trigger.event.data.params.move_mode}}'
- choose:
  - conditions: '{{ command == ''off'' }}'
    sequence: !input 'button_one_short_press'
  - conditions: '{{ command == ''on'' }}'
    sequence: !input 'button_two_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Up'' }}'
    sequence: !input 'button_three_short_press'
  - conditions: '{{  command == ''step'' and stepmode == ''StepMode.Down'' }}'
    sequence: !input 'button_four_short_press'
  - conditions: '{{  command == ''move'' and movemode == ''MoveMode.Up'' }}'
    sequence: !input 'button_three_long_press'
  - conditions: '{{  command == ''move'' and movemode == ''MoveMode.Down'' }}'
    sequence: !input 'button_four_long_press'
1 Like

Im a newbee with Home Assistant, sorry if my comment ist below the level of all the coding wizzards. My knowledge in YAML and HA coding is about zero.
I have a switch branded LIVARNO, which should be identical to the other brands, it is distributed by LIDL in Germany.
The switch can be found by HA but it identfies as _TYZB01_hww2py6b, so the Blueprint-file had to be modified.
My first blueprint used different ‘‘command’’ statements, but looking for {{ command == ‘‘step’’ and args == [0,51,10] }}’ did not give any result, though the Log clearly showed, that a ‘‘Step’’ event was fired and the parameters [0,51,10] did match.
Modifying these lines using ‘‘Stepmode.Up’’ and so did the job. Thanks to everyone, you did a great job.
Maybe the blueprint could be modified, so the device may be different from _TYZB01_bngwdjsr.
It would help newcomers very much, if the coding wizzards leave enough comments, teaching what they do, so we newbees can use thes files as lessons as well and learn from them. I understand, that HA ist developping so fast, that no documentation can follow this.

1 Like

Hi, thanks for this blueprint and the functionality on HA. I tried it, but must have made an mistake. Longpress is showing up, but has no reaction when pressing the button.
I needed to delete the following section (minus action) because it has not been defined and led to an error.

- conditions:
          - '{{ command == "step" }}'
          - "{{ args == [1, 51, 10] }}"
        sequence: !input "minus_action"

This one is working!!

1 Like

I have 4button silvercrest remote, in Zigbee HA identify as model: TS1001. On the back side HG 08376. And in thle blueprint, when a i would like make new automatization, it not selectable. How can i modify code ? Any sugestion ?

Hi everyone,

I am quite new to HA and just started using this blueprint with the Lidl remote and 4 Ikea Tradfri white light bulbs 1000 lumen in a light group created via an helper. I can manually change the brightness of the group. But… If I use button 3 or 4 in either short or long press with ‘brightness step value’ or ‘brightness step’ nothing happens. The log of the remote shows that commands where sent.

Button one and two are working fine and in traces the right choice is made. Buttons three and four do not trigger a choice and therefore no action is taken.

Any ideas?

Facing the same problem here.
I used the bluetprint from OP.

Only on and off button seem te respond correctly.
Any ideas?

Even with the conditions as described here nothing happens when using button 3 and 4.

The problem is that stepup and stepdown modes are now enums coming from ZHA. This means that his conditions are no longer working.

Conditions 3 and 4 should now be

  - conditions: '{{  command == ''step'' and stepmode == 0 }}'
    sequence: !input 'button_three_short_press'
  - conditions: '{{  command == ''step'' and stepmode == 1 }}'
    sequence: !input 'button_four_short_press'

I tried for the last 2 days, but I could not find a solution to set stepmode to 0 or 1.

stepmode: "{{trigger.event.data.params.step_mode}}" is
stepmode: StepMode.Up for button 3 and
stepmode: StepMode.Down for button 4

So a check against 0 or 1 will never be true, but a check against the string “StepMode.Up” or “StepMode.Down” would be true.

I found a working solution:

variables:
  command: "{{ trigger.event.data.command }}"
  button_mode: "{{ trigger.event.data.args[0] }}"
choose:
  - conditions: "{{ command == 'off' }}"
    sequence: !input 'button_one_short_press'
  - conditions: "{{ command == 'on' }}"
    sequence: !input 'button_one_short_press'
  - conditions: "{{ button_mode == 'StepMode.Up' }}"
    sequence: !input 'button_three_short_press'
  - conditions: "{{ button_mode == 'StepMode.Down' }}"
    sequence: !input 'button_four_short_press'
  - conditions: "{{ button_mode == 'MoveMode.Up' }}"
    sequence: !input 'button_three_long_press'
  - conditions: "{{ button_mode == 'MoveMode.Down' }}"
    sequence: !input 'button_four_long_press'

I will post the whole blueprint later. What is the standard way to get this published so everybody can get an updated version? @DamianQuest If you want you can update this blueprint, since this would be the simplest solution.