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

New config parameters to allow repeating the same request multiple times #85

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kkyryl
Copy link

@kkyryl kkyryl commented Aug 14, 2024

Based on my own need but figured others might benefit from this.

Specific use case:
I have a group of 5 somfy blinds, one of them being a newer generation motor. Ever since that new motor was installed, every once in a while it won't go up or down unless I press the button multiple times.

This new setting allows to repeat up/down/position command multiple times ensuring it will work every time.

@dxdc
Copy link
Owner

dxdc commented Aug 14, 2024

hey! thanks for this PR.

While I see the value of something like this, the proper implementation gets a bit complicated because:

  1. Sending commands multiple times like that will certainly mess up the ability to use a percentage adjustment (e.g., set blinds to 50%)

  2. Quickly sending commands (e.g., 'up', then 'down') may exhibit undesirable or confusing behavior

Are you getting a non-2XX response from your API endpoint or does it just not work sometimes? Certain devices have the ability to repeat the Rf signal multiple times, but not sure if that is your case.

For your specific case though, why not use a command-line script to customize the exact behavior you're looking for?

https://github.com/dxdc/homebridge-blinds?tab=readme-ov-file#triggering-command-line-scripts

@kkyryl
Copy link
Author

kkyryl commented Aug 14, 2024

hi!

  1. Yes, in my testing if I set the repeat value to, say 3, and delay 1-2 seconds it does mess up percentage adjustments (the shade jiggles up and down) but in case of 2 requests with 500ms delay it's perfectly fine. It's an acceptable situation for my case though.
  2. Yes, I can see that too. I just tested it and it seems to work fine in my setup but I understand this might be different for others.

I am using Bond hub to transmit actual signals and researched some options there as well.

  • I am getting 200/204 on all commands and Bond successfully sends those commands. The weird thing is the blind in question sometimes wiggles a bit. My guess here is that it's very sensitive to power, unlike other older motors. I tried replacing batteries and it does not exhibit this behavior on absolutely new batteries.
  • Bond has an option to repeat signal for commands but we send actions from the plugin and there's no configuration to repeat signal for actions. I still tried setting repeat signal values in Bond and it works when you use Bond app to operate the blinds, but not when I do it from Home app.

At the end of the day, this was the only solution that ended up working for me: in my (albeit limited) testing, sending 2 commands with 500ms delay for the specific blinds group solved the issue.

@dxdc
Copy link
Owner

dxdc commented Aug 14, 2024

You're using Bond? 😃

There is a much, much easier way. Simply change the reps property using the Bond API.

For instance:

curl -iH "Bond-Token: xxxxxxxxxxxxxxxx" http://192.168.50.220/v2/devices/d90ffd28/commands/08eb5024/signal -X PATCH -d '{"reps": 5}'

You can find more details on this on the Bond forums.

@dxdc
Copy link
Owner

dxdc commented Aug 14, 2024

Bond has an option to repeat signal for commands but we send actions from the plugin and there's no configuration to repeat signal for actions. I still tried setting repeat signal values in Bond and it works when you use Bond app to operate the blinds, but not when I do it from Home app.

Yes, the actions use the commands, I believe?

I use it this way and it works fine. Try increasing your reps as needed. One issue you may have is "grouping" blinds.... and seeing different behavior. E.g., it works fine one-at-a-time, but if you operate 3 at once you'll see this behavior. That is just signal interference, so try increasing the reps.

http://192.168.50.220/v2/devices/d90ffd28/actions/Open

@dxdc
Copy link
Owner

dxdc commented Aug 14, 2024

I tried replacing batteries and it does not exhibit this behavior on absolutely new batteries.

This also indicates it's a reception issue

@kkyryl
Copy link
Author

kkyryl commented Aug 14, 2024

@dxdc you went down the exact same path as I did ;)

  • I tried that approach described on the Bond forum. I found all the devices via the api and ended up adjusting "reps" for each command available but that did not help. And yes, according to their description Actions "translate" into Commands but looking at the API it does not seem to be the case. For example, I query for commands for a device and then get a command I see this:
    {"name":"50%","action":"SetPosition","argument":50,"button_type":null,"category_name":null,"feedback":"","icon":"stop","hidden":true,"_":"3b03e6ac","__":"a967c93d","signal":{"_":"3dff0485"},"tx":{"_":"00000000"}}
    The way I am reading this there's a command named "50%" which sends SetPosition action with "50" argument. There's no way to send an argument to the command. I can indeed modify signal reps for the command (and as I mentioned I did that for all the commands for a device in question just in case).
    if I get actions for a device I see what I expected:
    {"_":"00000000","__":"00000000","SetPosition":{"_":"00000000"},"Open":{"_":"00000000"},"DecreasePosition":{"_":"00000000"},"Close":{"_":"00000000"},"Hold":{"_":"00000000"},"IncreasePosition":{"_":"00000000"},"Preset":{"_":"00000000"},"Pair":{"_":"00000000"},"ToggleOpen":{"_":"00000000"},"Stop":{"_":"00000000"}}
    But there are no adjustments action signals.

I might be missing something brutally obvious but after spending a day on experiments (and setting 3 reps just in case) I ended up going up the chain (which worked).

@dxdc
Copy link
Owner

dxdc commented Aug 15, 2024

I hear you, getting this aligned perfectly can be tricky.

I would reach out to Bond support for help, they have been very helpful. Also, reps = 3 sounds low. I would try something more like 10.

Also, play with the positioning of your Bond and ensure nothing is blocking it - every try a different location. That may help a lot.

I appreciate what you've done here, but I think with the number of problems that are introduced (as discussed), I don't think I can merge this until those are addressed.

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

Successfully merging this pull request may close these issues.

2 participants