Open/close door sensor (EV1527)

Hi @Gratizzz

Try adding a switch with the debug info.

- platform: rflink
  device_defaults:
    fire_event: true
    signal_repetitions: 2
  devices:
    ev1527_08ebb0_0a:
      name: switchxx
1 Like

Hi @Petrica

Thanks for your quick reply!

I see the switch and it does switch on when I open the door.

In the log I see:
2018-01-02 23:14:12 DEBUG (MainThread) [homeassistant.components.rflink] passing event to []
2018-01-02 23:14:12 DEBUG (MainThread) [homeassistant.components.rflink] Fired bus event for switch.switchxx: on

But how can I merge the two on commands to an open/closed sensor?

@Gratizzz
I’m not very familiar with RFlink platform but I would say create two automations (one for the open signal from the first sensor and the other from the close signal) that have the payloads “on” and “off” sent in a single topic named “home/open_door_sensor_xxx” or similar, and a MQTT binary sensor setup with “on” and “off” payloads above.

Alternatively, as you already use RFLink, flash the Arduino Mega with https://github.com/1technophile/OpenMQTTGateway.

Setup is much easier than RFLink as the topic for the messages is unique, however the payloads are different. The integration is through MQTT (which is the greatest thing since the invention of hot water :slight_smile: )

@Petrica

Thanks! I think I will fix it with a few automations (a bit more work but fine for now!).

I will have a look at the OpenMQTTGatewat (new for me, but looks like hot water indeed!). Thanks for that! :slight_smile:

@Gratizzz
You’re welcome. Come back if you need help on the automation.

Hi @Gratizzz

You can change the commands to ON/OFF with RFlink and ‘RF Signal Learning’.

https://kris.bogaerts.org/2018/02/21/cheap-door-window-contact-ev1527-with-home-assistant-and-rflink/

Does it mean using OpenMQTTGateway instead of RFLink?

Hi all,
i dont know if is just for me, but every door sensor ev1527 that i have, send always SWITCH=0e when off and SWITCH=0a when on.
Since RFLink Signal Learning isnt stable for me, i tried to fix by adding on parser.py after the line 265 and before “return data” this:

correct ev1527 device ON/OFF command

if data.get('protocol', '') == 'ev1527' and data.get('switch', '') == '0e':
    data['command'] = 'off'


if data.get('protocol', '') == 'ev1527' and data.get('switch', '') == '0a':
    data['command'] = 'on'

Hope this can help someone.

Hi @jackdalma, this would be really cool and very helpful for me!

I just gave it a try but I end up with the following error:

2018-08-22 19:24:42 ERROR (MainThread) [homeassistant.setup] Error during setup of component rflink
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 145, in _async_setup_component
hass, processed_config)
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/rflink.py”, line 111, in async_setup
from rflink.protocol import create_rflink_connection
File “/home/pi/.homeassistant/deps/lib/python3.6/site-packages/rflink/protocol.py”, line 11, in
from .parser import (
File “/home/pi/.homeassistant/deps/lib/python3.6/site-packages/rflink/parser.py”, line 267
if data.get(‘protocol’, ‘’) == ‘ev1527’ and data.get(‘switch’, ‘’) == ‘0e’:
^
TabError: inconsistent use of tabs and spaces in indentation
2018-08-22 19:24:43 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.rflink. Setup failed for dependencies: rflink
2018-08-22 19:24:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.rflink: Could not setup all dependencies.

Screenshot of the parser.py file:

File location: …\home assistant\deps\lib\python3.6\site-packages\rflink

Hope you can help me out :slight_smile:

the error is related to indentation, check indentation of the first and third “if” on the screenshot, and apply the same on the second one.

Thanks! It was indeed that simple :slight_smile: working like a charm! Thanks a lot!

Hi @jackdalma, I just did a new install on my second hass platform (hassio image on raspberry pi 3). But now where can I find the file to edit? Do you know if it is even possible?

Hi,
I never used Hass.io image and i dont know if it is possible. I found this discussion
Editing Component Files in Hassio

Hey, @Gratizzz any chance you could post your config with the few extra automations? I’m using Hass.io so the Jacks’s solution isnt a solution for me.

Hi anyone get this to work on HASSIO install…tried the parser.py method but no joy…

2 @parfour & all:
I don’t think changing rflink source files is a particularly good idea to achieve what you want and offer a different approach.

You need:

  1. Define two rflink binary sensors:
binary_sensor:
   - platform: rflink
     devices:
       # on command
       ev1527_08ebb0_0a:
         off_delay: 1
       # off command
       ev1527_08ebb0_0e:
         off_delay: 1

These 2 sensors will be internal ones to receive those on and off commands. To enable it work as planned we need them to go back to off state as soon as possible (1 second here).

  1. Define a input_boolean that will represent state of your door sensor:
input_boolean:
  my_door_sensor:
  1. Create automations that will trigger that my_door_sensor as a reaction to any of our binary_sensors changing their states to on (meaning on or off command received):
automation:
  - alias: update_my_door_sensor
    trigger:
      - platform: state
        entity_id: binary_sensor.ev1527_08ebb0_0a
        from: 'off'
        to: 'on'
      - platform: state
        entity_id: binary_sensor.ev1527_08ebb0_0e
        from: 'off'
        to: 'on'
    action:
      service_template: input_boolean_turn{% if trigger.to_state.object_id.split('_')[2] == '0a'}on{%else%}off{%endif%}
      data:
         entity_id: input_boolean.my_door_sensor
  1. You can use this input_boolean as internal one if you don’t need to expose it to GUI.
    For GUI it’s better to show a sensor rather than input_boolean so you’ll need to define a template binary sensor for that:
binary_sensor:
  platform: template
    sensors:
      my_door:
        friendly_name: my door
        device_class: 'door'
        value_template: "{{ is_state('input_boolean. my_door_sensor', 'on') }}"

Hope it helps. I could’t check indentation and if it works at the moment but it should.
And ideally it requires some additional safety checks in templates like none/unknown etc.

  service_template: input_boolean_turn{% if trigger.to_state.object_id.split('_')[2] == '0a'}on{%else%}off{%endif%}
  data:
     entity_id: input_boolean.my_door_sensor

I hate to bump an old post but I need help. I managed to get everything set up but since “service_template” has been removed from HA and “service” has taken over, I am unable to figure this out.

What would the action portion look like if I were to use “service” instead. No matter what I try, I get a “Does not match format”

Bump? Can anyone shine some light on this?

I know it is an old topic, but i have figured out and fixed AhmadK’s script:

automation:
  - alias: update_my_door_sensor
    trigger:
      - platform: state
        entity_id: binary_sensor.ev1527_08ebb0_0a
        from: 'off'
        to: 'on'
      - platform: state
        entity_id: binary_sensor.ev1527_08ebb0_0e
        from: 'off'
        to: 'on'
    action:
      service: input_boolean_turn_{% if trigger.to_state.object_id.split('_')[2] == '0a'%}on{%else%}off{%endif%}
      data:
         entity_id: input_boolean.my_door_sensor

What i did:
service_template to service
input_boolean_turn to input_boolean_turn_
and there was a missing ‘%’ char after ‘0a’

But now i have a door open sensor.

I know this is an old topic, but i hope someone can help me.
I try to get the doorsensor working, but i don’t know what goes wrong.

The goal is to turn on the light when door opens, en turn off when the door closes.

This is the code i added to configuration.yaml

# configuration for RFlink
rflink:
  port: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

logger:
  default: error
  # add the following to the existing logger section

  logs:
    rflink: debug
    homeassistant.components.rflink: debug

light:
  # add the following to the existing light section
  - platform: rflink
    automatic_add: true

sensor:
  # add the following to the existing sensor section
  - platform: rflink
    automatic_add: true

binary_sensor:
  - platform: rflink
    devices:
      ev1527_0e0fb0_0a:
        name: Deur Hal Open
        off_delay: 1
      ev1527_0e0fb0_0e:
        name: Deur Hal Closed
        off_delay: 1

input_boolean:
  my_door_sensor_hal:

This is the code i added to automation.yaml

alias: update_my_door_sensor_hal
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.deur_hal_open
    from: "off"
    to: "on"
  - platform: state
    entity_id: binary_sensor.deur_hal_closed
    from: "off"
    to: "on"
action:
  - service: >-
      input_boolean_turn_{% if trigger.to_state.object_id.split('_')[2] ==
      '0a'%}on{%else%}off{%endif%}
    data:
      entity_id: input_boolean.my_door_sensor_hal

But how can i put on the light?

I added the following automation, but it doesn’t work

alias: lamp aan
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.my_door_sensor_hal
    from: "off"
    to: "on"
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.verlichting_hal_toilet
mode: single

I hope somebody can help me.