core: [satel-integra integration] Unable to switch switable_output sequentially

The problem

When using script it’s impossible to control two or more switchable_outputs sequentially. Workaround: add delay (at least 00:00:00.5) between next calls. Example script below. In this case second switchable_output will be never enabled or disabled (tried many times)

light_off:
  alias: Light - Off
  sequence:
  - service: switch.turn_off
    data: {}
    entity_id: switch.osw_front
  - service: switch.turn_off
    data: {}
    entity_id: switch.osw_taras
  mode: single
light_on:
  alias: Light - On
  sequence:
  - service: switch.turn_on
    data: {}
    entity_id: switch.osw_front
  - service: switch.turn_on
    data: {}
    entity_id: switch.osw_taras
  mode: single

Environment

  • Home Assistant Core release with the issue: 0.116.4
  • Last working Home Assistant Core release (if known): not known
  • Operating environment (OS/Container/Supervised/Core): Container
  • Integration causing this issue: satel_integra
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/satel_integra/

Problem-relevant configuration.yaml

satel_integra:
  host: 192.168.100.51
  port: 7094
  code: 0000
  partitions:
    01:
      name: 'Dol'
  switchable_outputs:
    17:
      name: 'Osw. Front'
    18:
      name: 'Osw. Taras'

Traceback/Error logs

hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Switch: Osw. Front status: False, turning on
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Switch: Osw. Taras status: False, turning on
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra] Outputs updated callback , status: {'outputs': {17: 1, 18: 0}}
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Osw. Front zones: {17: 1, 18: 0}
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: True
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Osw. Taras zones: {17: 1, 18: 0}
hass_1  | 2020-10-20 10:39:47 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False

Additional information

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 57 (6 by maintainers)

Most upvoted comments

Ok guys … there is an answer for your needs. I’ve forked integration repo made by one of the guys + forked satel_integra repo. After some “rebranding” and help by @michaljonik I applied changes from above zip archive, built it and push to PYPI projects which I linked with mentioned integration repo. This repo can be easily added to HACS and once downloaded and restarted all you need to do is a change in config from satel_integra to satel_integra_ext + restart. Looks that batch processing works well. By doing it this way through HACS changes will not be lost once HASS updates. You can find it here: https://github.com/leshqo/satel_integra_ext-ha

Yepp, no work has been done on it. But I haven’t given up on it, winter comes, so Ill try to find some time… Sorry for looooooooooooong wait 😦

Great job @leshqo 🎉👏🏻 I already installed the component and finally the “Scenes” from HomeKit now have a sense🥳

I just downloaded the zip file form comments above and addedd it to my container with home assistant, using the command form the comments above. Then restarted HA. Possibly, it’d be best to also include that other fix from #42111 (comment)

Any idea how to apply it to non dockerized HASS?

I managed to enable batch state switch updates (on / off) in the following patch to the underlying satel_integra library (see this project: https://github.com/c-soft/satel_integra). It’s very quick and dirty and not really tested thoroughly yet. Unfortunately I have no idea how to put that in the main repository (I can’t commit even into a separate branch, so publishing the updated source here). satel_integra.zip

Upon further testing, it mostly works, but not always. It works for multiple outputs, like 2 lights. But does not work, when in a scene I also want to arm or disarm the alarm (e.g. a night scene, turning off all lights and arming the Satel system) - the switches work, but the alarm doesn’t start to arm.

I just downloaded the zip file form comments above and addedd it to my container with home assistant, using the command form the comments above. Then restarted HA. Possibly, it’d be best to also include that other fix from https://github.com/home-assistant/core/issues/42111#issuecomment-1616130426

@c-soft Please help integrate @pawelgarbacz & @mgruszka-ops fix. There are a lot of us that are waiting for it to be fixed. Since my whole set-up is used through Homekit, I can’t use Scenes (no way to put delays in them) and many of them don’t work…

Posted this issue in the underlying satel integration library. I hope this allows us to put the change in the default code base since now any HA version update causes overwriting the library with old code (at least in docker environment).

@c-soft, what would be the way to promote the above changes to your library so it gets pulled from repository with HA?

I run my HA on Docker, so after altering the library code I uploaded it to docker container using the following command:

docker cp satel_integra.py homeassistant:/usr/local/lib/python3.11/site-packages/satel_integra/satel_integra.py

You must check in your case what Python version you have and whether the site-packages reside at this particular location. You can enter the docker instance using this command: docker exec -it homeassistant /bin/bash and look in the filesystem where is the satel_integra.py script

I managed to enable batch state switch updates (on / off) in the following patch to the underlying satel_integra library (see this project: https://github.com/c-soft/satel_integra). It’s very quick and dirty and not really tested thoroughly yet. Unfortunately I have no idea how to put that in the main repository (I can’t commit even into a separate branch, so publishing the updated source here). satel_integra.zip

.0x03 0x00 0x00 0x10 translates to (in binary)

1100000 0000000 0000000 00001000

“1” on certain position codes specific zone/output/partition as active/affected. Just the order of bit positions is reversed 😃

Hi, I in fact face similar issue: having defined multiple covers grouping pairs of switchable ouptuts when I try to close more than one of them at the same time only the first one (always the first one only even if I change the order of entities) in the defined group is responding (the output is activated) and others are not.

The configuration is as follows:

configuration.yaml file:

satel_integra:
  ...
  switchable_outputs:
    57:
      name: "Satel - roleta: gabinet (otwórz)"
    58:
      name: "Satel - roleta: gabinet (zamknij)"
    59:
      name: "Satel - roleta: sypialnia (otwórz)"
    60:
      name: "Satel - roleta: sypialnia (zamknij)"

For these two inputs I created covers called “sypialnia” and “gabinet” using template platform and then I grouped these under group cover - config below:

  - platform: template
    covers:
      sypialnia:
        device_class: shade
        friendly_name: Sypialnia
        open_cover:
          service: switch.turn_on
          target:
            entity_id: switch.satel_roleta_sypialnia_otworz
        close_cover:
          service: switch.turn_on
          target:
            entity_id: switch.satel_roleta_sypialnia_zamknij
        stop_cover:
          service: switch.turn_off
          target:
            entity_id:
              - switch.satel_roleta_sypialnia_otworz
              - switch.satel_roleta_sypialnia_zamknij

      gabinet:
        device_class: shade
        friendly_name: Gabinet
        open_cover:
          service: switch.turn_on
          target:
            entity_id: switch.satel_roleta_gabinet_otworz
        close_cover:
          service: switch.turn_on
          target:
            entity_id: switch.satel_roleta_gabinet_zamknij
        stop_cover:
          service: switch.turn_off
          target:
            entity_id:
              - switch.satel_roleta_gabinet_otworz
              - switch.satel_roleta_gabinet_zamknij

  - platform: group
    unique_id: rolety_pietro
    name: Rolety (piętro)
    entities:
      - cover.sypialnia
      - cover.gabinet

See part of my log:

2022-01-05 11:27:25 INFO (MainThread) [homeassistant.components.script.rolety_pietro_zamknij] Rolety piętro - zamknij: Running script sequence
2022-01-05 11:27:25 INFO (MainThread) [homeassistant.components.script.rolety_pietro_zamknij] Rolety piętro - zamknij: Executing step call service
2022-01-05 11:27:25 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Switch: Satel - roleta: sypialnia (zamknij) status: False, turning on
2022-01-05 11:27:25 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Switch: Satel - roleta: gabinet (zamknij) status: False, turning on
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra] Outputs updated callback , status: {'outputs': {57: 0, 58: 0, 59: 0, 60: 1}}
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: gabinet (otwórz) zones: {57: 0, 58: 0, 59: 0, 60: 1}
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: gabinet (zamknij) zones: {57: 0, 58: 0, 59: 0, 60: 1}
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: sypialnia (otwórz) zones: {57: 0, 58: 0, 59: 0, 60: 1}
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: sypialnia (zamknij) zones: {57: 0, 58: 0, 59: 0, 60: 1}
2022-01-05 11:27:26 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: True
2022-01-05 11:27:28 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Switch name: Satel - roleta: sypialnia (zamknij) status: True, turning off
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra] Outputs updated callback , status: {'outputs': {57: 0, 58: 0, 59: 0, 60: 0}}
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: gabinet (otwórz) zones: {57: 0, 58: 0, 59: 0, 60: 0}
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: gabinet (zamknij) zones: {57: 0, 58: 0, 59: 0, 60: 0}
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: sypialnia (otwórz) zones: {57: 0, 58: 0, 59: 0, 60: 0}
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] Update switch name: Satel - roleta: sypialnia (zamknij) zones: {57: 0, 58: 0, 59: 0, 60: 0}
2022-01-05 11:27:29 DEBUG (MainThread) [homeassistant.components.satel_integra.switch] New state: False

From what I’ve been able to find out from this debugging information it seems that only the first message (although HA is sending all of them to Satel integration component) gets sent to ETHM-1 Plus (async?) and before it’s getting confirmed the second one is probably sent when ETHM-1 Plus is not ready yet to process it (?).

Maybe it would be good to batch such messages somehow and send them together? From what I’ve read in protocol specification it seems that one can activate multiple outputs in a single message so I thought if we e.g. send only first state change (async) and put the next ones coming in from HA in some buffer in Satel integration component until received confirmation from ETHM-1 it’s been processed (status update) and only then send all other messages in a single call - maybe this would solve the issue?

The issue as I observed is a general one - not related to covers only - it does not even allow for control of group of lights (using UI-level group switch and predefined group of entities) too (tried that - same symptoms, first one switching on/off, rest are not responding at all, but individually are responsive 😃.

Let me know if you needed any additional debugging info or help with testing the changes.