Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aqara door sensors + value_template #38

Open
m4r1k opened this issue May 14, 2024 · 6 comments
Open

aqara door sensors + value_template #38

m4r1k opened this issue May 14, 2024 · 6 comments

Comments

@m4r1k
Copy link

m4r1k commented May 14, 2024

Hey there!

I'm in love with this integration! It has automated one of the last remaining item at home.

All doors and windows have aqara sensors, integrated in HA through the Aqara E1 hub.
On HA side their status is exposed through the native HomeKit integration.

Screenshot 2024-05-14 at 21 45 09

Now, with the following config, the window state (open, opening, closing, closed) becomes unresponsive.

cover:
  - platform: becker
    device: "/dev/ttyACM0"
    filename: "my-centronic-stick.db"
    covers:
      bathroom:
        friendly_name: "Bathroom Velux"
        channel: "1"
        tilt_intermediate: off
        travelling_time_up: 40
        travelling_time_down: 50
        value_template: "{{ 0 if is_state('binary_sensor.bathroom_velux_sensor', 'closed') else None }}"

The Window "Value Template" status in HA remains also unknown.

I kinda have a clue this issue might be related to the type of sensors exposed by the HomeKit integration, which is a binary_sensor.

Any clue if I'm doing something wrong? The code doesn't show, to me at least, a preference for a specific type of HA sensor. Any help is greatly appreciated.

@RainerStaude
Copy link
Owner

RainerStaude commented May 18, 2024

Anything in the log with log level debug enabled?
There should be something in the log whenever the result of the template changes
Is the template properly returning 0 or None?

I guess you also have a master remote. So check the log and add the remote_id to the config remote_id: "12345:2"

@m4r1k
Copy link
Author

m4r1k commented Jun 16, 2024

Hey @RainerStaude

Apologies for such late answer!! Where I live rained nonstop and it was difficult to do the debug.
See the following logs:

2024-06-16 13:23:34.643 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration becker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-06-16 13:23:35.637 INFO (MainThread) [homeassistant.setup] Setting up becker
2024-06-16 13:23:35.637 INFO (MainThread) [homeassistant.setup] Setup of domain becker took 0.00 seconds
2024-06-16 13:23:35.637 INFO (MainThread) [homeassistant.components.cover] Setting up becker.cover
2024-06-16 13:23:35.637 DEBUG (MainThread) [custom_components.becker.cover] device: /dev/ttyACM0; filename: my-centronic-stick.db
2024-06-16 13:23:35.638 DEBUG (MainThread) [custom_components.becker.rf_device] Use filename: my-centronic-stick.db
2024-06-16 13:23:35.639 DEBUG (MainThread) [custom_components.becker.pybecker.becker_helper] Try to open connection.
2024-06-16 13:23:35.644 DEBUG (Thread-2) [custom_components.becker.pybecker.becker_helper] BeckerCommunicator thread started.
2024-06-16 13:23:35.645 WARNING (MainThread) [custom_components.becker.cover] Both "value_template" and "travelling_time" are configured for cover Bathroom Velux. "value_template" might influence with "travelling_time"!
2024-06-16 13:23:35.649 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'becker' accesses hass.helpers.dispatcher. This is deprecated and will stop working in Home Assistant 2024.11, it should be updated to import functions used from dispatcher directly at custom_components/becker/cover.py, line 253: receive = self.hass.helpers.dispatcher.async_dispatcher_connect(, please report it to the author of the 'becker' custom integration
2024-06-16 13:23:35.650 DEBUG (MainThread) [custom_components.becker.cover] Bathroom Velux: Update template with result: None with type <class 'NoneType'>

I believe the template returns None. Was this expected?

@mad-sysadmin
Copy link

mad-sysadmin commented Jan 12, 2025

@RainerStaude Many thanks for the custom_component. All is working well here with Roto windows and their outside covers: we can actively control all Becker devices from Home Assistant; all messages from the remote controls are processed by Home Assistant.

However, we have a similar issue as @m4r1k.

The LOG indicates that the value_template returns either 0 or None. The TEMPLATE playground in the developer tools confirms that the definition of the value_template is indeed correct.

Still, the status of the relevant entity in our dashboard doesn't update. In our case it remains closed forever.

If we delete the value_template line, all is good: status of the entity is again updated.

Our becker.yaml includes:

    covers:
      2og_zi5_win_bck_1:
        friendly_name: "2og_zi5 DFF links"
        travelling_time_up: 12
        travelling_time_down: 26
        intermediate_position: off
        tilt_intermediate: off
        channel: "1:1"
        remote_id: "0FDF4:1"
        value_template: "{{ 0 if is_state('binary_sensor.hm_sec_sc_2_oeq0177593', 'off') else None }}"
      2og_zi5_win_bck_3:
        friendly_name: "2og_zi5 DFF rechts"
        travelling_time_up: 12
        travelling_time_down: 26
        intermediate_position: off
        tilt_intermediate: off
        channel: "1:3"
        remote_id: "0FDF4:3"

The STATES section in the developer tools does indicate something unusual. The number of attributes differs between the entity with the value_template and the other; although the definition is otherwise almost identical.

It seems to us as if the travelling_time lines are somehow not taken into account if there is a value_template defined.

with and without value_template

@mad-sysadmin
Copy link

Note to self: Read the code first. ☺️

This certainly explains the behavior.

@m4r1k
Copy link
Author

m4r1k commented Jan 13, 2025

@mad-sysadmin that would make sense but then the following config still does not work:

cover:
  - platform: becker
    device: "/dev/ttyACM0"
    filename: "my-centronic-stick.db"
    covers:
      bathroom:
        friendly_name: "Bathroom Velux"
        channel: "1"
        tilt_intermediate: off
        value_template: "{{ 0 if is_state('binary_sensor.bathroom_velux_sensor', 'closed') else None }}"

@RainerStaude
Copy link
Owner

Let me check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants