RF Blindes Automation

hi

im trying to automate my rf controlled blindes with no feedback.

i would like to be able to control it with a up/down switch and also be able to stop it while it moves.
since i also have another rf remote i don’t want to block the controlls with time to much so i still can use both.

any ideas?

Hi,

here is how I did it for RF433 (no-rolling code) blinds:

platform: mqtt
name: "RF433"
state_topic: "sonoffrf433/tele/RESULT"
json_attributes_topic: "sonoffrf433/tele/RESULT"
value_template: >-
    {% if value_json.RfRaw.Data| regex_search('28181819081800000000000909090819090819081818181909\s55') %}
    blinds_open
    {% elif value_json.RfRaw.Data| regex_search('28190908181909090909081900000000000819081819090818\s55') %}
    blinds_close
    {% elif value_json.RfRaw.Data| regex_search('281909081819090909090819111111100000819081819090818\s55') %}
    blinds_stop
    {% endif %}
  • create input booleans for blinds_open and blinds_remote
  • do automations for blinds_open, blinds_close (when controling from HA):
alias: "RF433 reluxa close"
initial_state: "on"
trigger:
  platform: state
  entity_id: sensor.rf433
  to: "blinds_close"
action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.blinds_remote
  - service: input_boolean.turn_off
    entity_id: input_boolean.blinds_open

and blinds_remote:

alias: "Blinds remote post action"
initial_state: "on"
trigger:
  platform: state
  entity_id: input_boolean.blinds_open
condition:
  - condition: state
    entity_id: input_boolean.blinds_remote
    state: 'on'
action:
  - delay: 00:00:04
  - service: input_boolean.turn_off
    entity_id: input_boolean.blinds_remote

and rf433_blinds_close and rf433_blinds_open for the case when using the RF remote:

alias: "RF433 blinds close"
initial_state: "on"
trigger:
  platform: state
  entity_id: sensor.rf433
  to: "blinds_close"
action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.blinds_remote
  - service: input_boolean.turn_off
    entity_id: input_boolean.blinds_open
  • define a cover entity:
  blinds:
    friendly_name: "Bedroom blinds"
    value_template: >-
      {% if states('input_boolean.blinds_open') == "on" %}
        open
      {% else %}
        closed
      {% endif %}
    open_cover:
      service: script.blinds_open_script
    close_cover:
      service: script.blinds_close_script
    stop_cover:
      service: script.blinds_stop
    icon_template: >-
      {%- if is_state('input_boolean.blinds_open', 'on') -%}
      mdi:window-shutter-open
      {%- else -%}
      mdi:window-shutter
      {% endif %}
  • define the scripts to control the blinds:
blinds_open_script:
  alias: 'Open blinds script'
  sequence:
    service: input_boolean.turn_on
    data:
      entity_id: input_boolean.blinds_open
blinds_close_script:
  alias: 'Close blinds script'
  sequence:
    service: input_boolean.turn_off
    data:
      entity_id: input_boolean.blinds_open
blinds_open:
  alias: 'Open blinds'
  sequence:
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw AAB035050812C005E602D001682000000002A3B2B2B2B2A3A3B2A3B2B2A3A3B2A3B2A3B2B2B2A3B2B2B2B2B2A3B2B2B2A3B2B2B2A55"
    - delay:
        seconds: 1
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw 177"

blinds_close:
  alias: 'Close blinds'
  sequence:
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw AAB035050812C005F002BC017C2774481A000000000000000A3B2A3B2B2A3A3B2A3B2A3B2B2B2A3B2B2B2B2B2A3B2B2A3A3B2B2A3A55"
    - delay:
        seconds: 1
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw 177"

blinds_stop:
  alias: 'Stop blinds'
  sequence:
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw AAB035050812AC05F002B201722788481A3B2A3A000000000000002A3B2B2A3A3B2A3B2A3B2B2B2A3B2B2B2B2B2A3B2A3B2A3B2A3B2A55"
    - delay:
        seconds: 1
    - service: mqtt.publish
      data_template:
        topic: sonoffrf433/cmnd/Backlog
        retain: false
        payload: "RfRaw 177"

blinds_toggle:
  alias: 'Toggle blinds'
  sequence:
    - service: "script.blinds_{% if is_state('cover.blinds', 'closed')%}open{% else %}close{% endif %}"

blinds_toggle_script:
  alias: 'Toggle blinds script'
  sequence:
    service: input_boolean.toggle
    data:
      entity_id: input_boolean.blinds_open

This will ensure that the state of the input_boolean.blinds_open is consistant regardless of using HA or the RF remote to control the blinds.

The rest is UI magic.

I hope I did not miss anything.

3 Likes

Hello thanks for your post.
I cant get it to work, can you please specify where you enter the code you posted aka which files each code piece belong to.

Thanks in advance

Tom

The first one (platform: mqtt) goes into sensors; the 2nd-4th ones go into automations, the fifth one (cover) goes into cover and the sixth section (blinds_open_script, blinds_close_script, blinds_open, etc) goes into script.
The above structuring presumes the following configuration.yaml

automation: !include_dir_list automations
cover: !include covers.yaml
script: !include scripts.yaml
sensor: !include_dir_list sensors

namely each automation and sensor is a file in the automations and the sensors directory respectively, while covers.yaml contains all definitions for all covers, like:

platform: template
covers:
  blinds:
    friendly_name:...

and scripts.yaml lists all scripts.

2 Likes

Hey @amaximus :slight_smile:

This is exactly what I’m after but I’m having trouble getting it working
Do you have your current config for this hosted anywhere that I can look at?

Thanks :slight_smile: