rstrouse / ESPSomfy-RTS-HA

Control your somfy shades in Home Assistant
The Unlicense
102 stars 9 forks source link

HA not sending open or close signals at once to multiple shades #20

Open senolsun opened 10 months ago

senolsun commented 10 months ago

Hello.

When I set up an automation to control multiple shades at once with a single automation line, only one of the shades get the signal and the other one doesn't. ESPSomfy shows both shades as open but in reality the signal is sent to only one shade. Ekran Resmi 2023-08-24 12 24 36

rstrouse commented 10 months ago

You should use the grouping functionality in ESPSomfy RTS. It is loads more efficient and the correct way to send multiple commands to the motors.

senolsun commented 10 months ago

thanks, that worked, however it doesn't change the fact that my previous workflow fails, so this still remains as an issue in my opinion. Feel free to close it.

ElmarJordan commented 9 months ago

Hello

I have organized my shutters in groups. Control by group also works great. If I address the group in an automation, I can also trigger this directly and the shutters are controlled. Time-controlled, the automation is displayed as listed, but the shutters are not controlled.

rstrouse commented 9 months ago

@ElmarJordan what service are you calling?

ElmarJordan commented 9 months ago

here are two examples of open or close image

image

rstrouse commented 9 months ago

Interesting. It appears the close_cover service is not supported by cover groups in HA. I will chase that down. Change that service to use the ESPSomfy RTS: Close Shade service. Your automation will then work.

image

alias: New Automation
description: ""
trigger:
  - platform: time
    at: "09:50:00"
condition: []
action:
  - service: espsomfy_rts.close_shade
    data: {}
    target:
      entity_id: cover.group1
mode: single
ElmarJordan commented 9 months ago

thank you I will try it an give you an feedback

rstrouse commented 9 months ago

I figured out the reason why it does not show support for the close_cover service. This has to do with the way groups are defined in HA. Home assistant does not set up the group completely until it gets refreshed the first time. So if your click the 3 dots on the integration and press reload it with also start working even with the close_cover service.

I will have to find a way around the group initialization code to make it finish setting it up.

EDIT: It also correctly sets itself up if you restart Home Assistant.

rstrouse commented 9 months ago

@senolsun in v2.1.8 I have made the async process for the send the commands one at a time so your previous setup should work fine. HA was running the steps in conjunction so it was executing the services for each of the entities at the same time. The radio can only send these sequentially.

ElmarJordan commented 9 months ago

With the ESPSomfy RTS: Close Shade / ESPSomfy RTS: Open Shade service it works now. What I have also noticed is that if I address in two different automations with two different groups also only one works. I have separated the automations by one minute so it works. The only thing that remains is that the reception of my remote controls (Smoove 1 RTS) is very unreliable. Is this due to the remote control or the reception of the ESP32/CC1101?

rstrouse commented 9 months ago

Is this due to the remote control or the reception of the ESP32/CC1101?

I have had receivers that had poor range. And another user just recently changed out their esp32 and a motor that previously wouldn’t even pair finally worked. In v2.1.8 there is a frequency scanner that you can try to see if perhaps the smoove isn’t tuned to very well. ESPSomfy RTS can be adjusted with that.

ElmarJordan commented 9 months ago

Thanks the function I had already found and experimented with the frequencies. But unfortunately did not bring any improvement, the default frequency 433.420 is the best.

Nickduino commented 5 months ago

@senolsun in v2.1.8 I have made the async process for the send the commands one at a time so your previous setup should work fine. HA was running the steps in conjunction so it was executing the services for each of the entities at the same time. The radio can only send these sequentially.

Shouldn't that be managed by the ESP32 (when it receives N commands, it sends them 1 by 1 with a 0.5 s delay for instance)? That way, it would work with all integrations.

Is this due to the remote control or the reception of the ESP32/CC1101?

Radio hams tend to say that there is more to gain with a good reception than with a the transmission. And there's the law (you can emit high power without a ham licence). And there's the fact you can't really improve the transmission power of your Somfy remote. So moving your ESPSomfy and/or changing its antenna is your best bet.

rstrouse commented 5 months ago

Shouldn't that be managed by the ESP32 (when it receives N commands, it sends them 1 by 1 with a 0.5 s delay for instance)? That way, it would work with all integrations.

Not really as the radio wasn't the overall issue. HA was firing off the http requests all at once (near parallel) and the ESP32 is not fast enough to negotiate a closed connection and respond before HA sent the command for the next motor so it would fail because the api was being interrupted before it could say 200.

The await ensures it does not start a new http request before the old one is negotiated. This shouldn't be an issue anymore since the radio serializes faster than the aio can deliver. The timing is around 170ms per repeat and cannot be shortened over the interframe silence anyway.

The only way to make all the shades move at the same time is to send the grouped shade command which amounts to a single frame (or repeated). But the coverGroup in HA is wonky when you want to set a position on the group. Up/Down/My have all been optimized to send only one frame. With a position target HA will fire these off for each motor on separate threads. While the position will be accurate there may be a very small subsecond delay between motors at the start.

Nickduino commented 5 months ago

Not really as the radio wasn't the overall issue.

I had misunderstood, my bad.

Baseje commented 5 months ago

I experience the same issue; When i've created an group in ESPSomfy and push the button to down/up for the group both motors go instantly and together on the same time. But when i push the group (which is automatically created by the integration) in Home Assistant, there is an short delay of 1/2 seconds between both motors. Its looks like the intergration didn't use the same action in ESPSomfy as the button on the webinterface. Any idea?

rstrouse commented 5 months ago

The up,down, and my buttons should send only 1 command from the plug-in. This is true for me. Setting a target position is another story though as HA breaks it down into individual commands. Since the transceiver can only send one command at a time, it takes at least 170ms plus 170ms times the number of repeats.

daviss57 commented 2 months ago

I've had the following issue when grouping shades. When I set the position to say 50% the blinds all go to different positions. It seems like it averages the movement of all to add up to a 50% movement. One bond may have moved 10mm and another might have moved 500mm. Had to go back to sending individual commands with 1 second. delay

rstrouse commented 2 months ago

That's new. Which HA version are you running. It would really be stupid if the covergroup started issuing stop commands.

daviss57 commented 2 months ago

That's new. Which HA version are you running. It would really be stupid if the covergroup started issuing stop commands.

2024.4.2

daviss57 commented 2 months ago

Screenshot_20240410_235326_Chrome

Is it related to this section in the notes?

rstrouse commented 2 months ago

Nope the HA cover group entity is a different animal that seems to have gotten some attention lately. ESPSomfy RTS is issuing a single command for up/down/my when any of those buttons are pressed but when the covergroup position is set from within HA all bets are off and it attempts to seek the position itself. I wish it wouldn't.

Nickduino commented 2 months ago

Does HA need to know the group is a grouped command?

daviss57 commented 2 months ago

Nope the HA cover group entity is a different animal that seems to have gotten some attention lately. ESPSomfy RTS is issuing a single command for up/down/my when any of those buttons are pressed but when the covergroup position is set from within HA all bets are off and it attempts to seek the position itself. I wish it wouldn't.

That may explain it so. When I use the up down command from HA, all works OK. It's only when I give the set position command that it goes haywire. Anyway, I've reverted to using the individual command for each shade. Great project. Thanks.