Z2M - DIYRuZ FreePad LeTV 8 button remote

TODO…

blueprint:
  name: Z2M - DIYRuZ FreePad LeTV 8 Button Remote
  description: Automate your LeTV 8 button remote of FreePad firmware.
  domain: automation
  source_url: https://community.home-assistant.io/t/z2m-diyruz-freepad-letv-8-button-remote/296509
  input:
    remote:
      name: FreePad LeTV 8 Remote Action
      selector:
        entity:
          integration: mqtt
          domain: sensor
    button_4_single:
      name: Button Up (single press)
      default: []
      selector:
        action: {}
    button_4_double:
      name: Button Up (double press)
      default: []
      selector:
        action: {}
    button_4_hold:
      name: Button Up (long press)
      default: []
      selector:
        action: {}
    button_2_single:
      name: Button Down (single press)
      default: []
      selector:
        action: {}
    button_2_double:
      name: Button Down (double press)
      default: []
      selector:
        action: {}
    button_2_hold:
      name: Button Down (long press)
      default: []
      selector:
        action: {}
    button_5_single:
      name: Button Left (single press)
      default: []
      selector:
        action: {}
    button_5_double:
      name: Button Left (double press)
      default: []
      selector:
        action: {}
    button_5_hold:
      name: Button Left (long press)
      default: []
      selector:
        action: {}
    button_3_single:
      name: Button Right (single press)
      default: []
      selector:
        action: {}
    button_3_double:
      name: Button Right (double press)
      default: []
      selector:
        action: {}
    button_3_hold:
      name: Button Right (long press)
      default: []
      selector:
        action: {}
    button_8_single:
      name: Button Center (single press)
      default: []
      selector:
        action: {}
    button_8_double:
      name: Button Center (double press)
      default: []
      selector:
        action: {}
    button_8_hold:
      name: Button Center (long press)
      default: []
      selector:
        action: {}
    button_1_single:
      name: Button Back (single press)
      default: []
      selector:
        action: {}
    button_1_double:
      name: Button Back (double press)
      default: []
      selector:
        action: {}
    button_1_hold:
      name: Button Back (long press)
      default: []
      selector:
        action: {}
    button_7_single:
      name: Button Play (single press)
      default: []
      selector:
        action: {}
    button_7_double:
      name: Button Play (double press)
      default: []
      selector:
        action: {}
    button_7_hold:
      name: Button Play (long press)
      default: []
      selector:
        action: {}
    button_6_single:
      name: Button Voice (single press)
      default: []
      selector:
        action: {}
    button_6_double:
      name: Button Voice (double press)
      default: []
      selector:
        action: {}
    button_6_hold:
      name: Button Voice (long press)
      default: []
      selector:
        action: {}

mode: restart
max_exceeded: silent

trigger:
- platform: state
  entity_id: !input 'remote'
  from: ""

condition:
- condition: template
  value_template: "{{ 'button' in trigger.to_state.state }}"

action:
- variables:
    command: '{{ trigger.to_state.attributes.action }}'
- choose:
  - conditions:
    - '{{ command == "button_1_single" }}'
    sequence: !input 'button_1_single'
  - conditions:
    - '{{ command == "button_1_double" }}'
    sequence: !input 'button_1_double'
  - conditions:
    - '{{ command == "button_1_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_1_release
          attribute: action
        sequence: !input 'button_1_hold'
  - conditions:
    - '{{ command == "button_2_single" }}'
    sequence: !input 'button_2_single'
  - conditions:
    - '{{ command == "button_2_double" }}'
    sequence: !input 'button_2_double'
  - conditions:
    - '{{ command == "button_2_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_2_release
          attribute: action
        sequence: !input 'button_2_hold'
  - conditions:
    - '{{ command == "button_3_single" }}'
    sequence: !input 'button_3_single'
  - conditions:
    - '{{ command == "button_3_double" }}'
    sequence: !input 'button_3_double'
  - conditions:
    - '{{ command == "button_3_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_3_release
          attribute: action
        sequence: !input 'button_3_hold'
  - conditions:
    - '{{ command == "button_4_single" }}'
    sequence: !input 'button_4_single'
  - conditions:
    - '{{ command == "button_4_double" }}'
    sequence: !input 'button_4_double'
  - conditions:
    - '{{ command == "button_4_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_4_release
          attribute: action
        sequence: !input 'button_4_hold'
  - conditions:
    - '{{ command == "button_5_single" }}'
    sequence: !input 'button_5_single'
  - conditions:
    - '{{ command == "button_5_double" }}'
    sequence: !input 'button_5_double'
  - conditions:
    - '{{ command == "button_5_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_5_release
          attribute: action
        sequence: !input 'button_5_hold'
  - conditions:
    - '{{ command == "button_6_single" }}'
    sequence: !input 'button_6_single'
  - conditions:
    - '{{ command == "button_6_double" }}'
    sequence: !input 'button_6_double'
  - conditions:
    - '{{ command == "button_6_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_6_release
          attribute: action
        sequence: !input 'button_6_hold'
  - conditions:
    - '{{ command == "button_7_single" }}'
    sequence: !input 'button_7_single'
  - conditions:
    - '{{ command == button_7_double }}'
    sequence: !input 'button_7_double'
  - conditions:
    - '{{ command == "button_7_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_7_release
          attribute: action
        sequence: !input 'button_7_hold'
  - conditions:
    - '{{ command == "button_8_single" }}'
    sequence: !input 'button_8_single'
  - conditions:
    - '{{ command == "button_8_double" }}'
    sequence: !input 'button_8_double'
  - conditions:
    - '{{ command == "button_8_hold" }}'
    sequence:
    - repeat:
        until:
        - condition: state
          entity_id: !input 'remote'
          state: button_8_release
          attribute: action
        sequence: !input 'button_8_hold'

1 Like

Hi,

Could you please post one or two sentences explaining this?

I think this might be useful. I see lots of unanswered questions about “modkam.ru DIYRuZ_FreePad”.

There are lots of newbies like me who have not worked with blueprints before. A few added words will get better search results too.

Thanks!