awesome-ha-blueprints icon indicating copy to clipboard operation
awesome-ha-blueprints copied to clipboard

Osram Switch Mini (button_center_double_press)

Open pex81 opened this issue 3 years ago • 12 comments

Thank you for taking the time to report here! :tada:

Please don't delete any part of the template, since keeping the provided structure will help maintainers to process your request more rapidly.

This template should only be used to report a bug with a blueprint. If this is not your case, you can choose a different issue template. If you have a question instead, please open a discussion here.

*=required

Bug Details*

  • Blueprint name: Controller - Osram SMART+ Switch Mini
  • Home Assistant Core Version: 2021.6.5
  • Home Assistant Installation Type: Home Assistant Supervised

Description*

I tried the blueprint with Osram Smart + Switch Mini and it works very well, the only feature that is not right is the double middle button. I tried with 2 mini switches and it does the same thing, it doesn't perform the action.

Automation YAML config*

- alias: Osram Switch Camera
  description: ''
  use_blueprint:
    path: EPMatt/osram_ac025xx00nj.yaml
    input:
      integration: ZHA
      controller_device: 329556686e830cb76d019012e8664378
      action_button_up_double:
      - type: turn_on
        device_id: fb31e5b6e32e2a33b2fe8e53614af58c
        entity_id: switch.presa_iphone
        domain: switch
      action_button_center_double:
      - type: toggle
        device_id: fb31e5b6e32e2a33b2fe8e53614af58c
        entity_id: switch.presa_iphone
        domain: switch
      action_button_down_double:
      - type: turn_off
        device_id: fb31e5b6e32e2a33b2fe8e53614af58c
        entity_id: switch.presa_iphone
        domain: switch
      button_up_double_press: true
      button_center_double_press: true
      button_down_double_press: true
      helper_last_controller_event: input_text.prova

To Reproduce*

Steps to reproduce the issue:

  1. Go to '...'
  2. Click on '....'
  3. Trigger the automation '....'
  4. See error

Expected behavior*

A clear and concise description of what you expected to happen.

Actual Behaviour*

The double up button works The double down button works The double center button does not work

Even with the same action.

Additional Details*

  • [ ] I'd like to help developing a fix for this issue.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

pex81 avatar Jun 17 '21 14:06 pex81

Could you please post the events generated by the double-click of the center button?

You can do it by using the developer tools section of HA, then go to events tab and in the input box of listen to events write zha_event, then click on the start listening button. Then double click on the center button, and you should see a series of events generated. Paste them in the reply, so @EPMatt can debug things faster. :)

image

alexdelprete avatar Jun 18 '21 01:06 alexdelprete

i am testing this setup in automation. Thanks.

      action_button_center_double:
      - service: switch.toggle
        data:
          entity_id: switch.presa_iphone  
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:0d:6f:00:0e:1b:79:1a",
        "unique_id": "00:0d:6f:00:0e:1b:79:1a:3:0x0008",
        "device_id": "329556686e830cb76d019012e8664378",
        "endpoint_id": 3,
        "cluster_id": 8,
        "command": "move_to_level_with_on_off",
        "args": [
            254,
            10
        ]
    },
    "origin": "LOCAL",
    "time_fired": "2021-06-18T06:31:37.135071+00:00",
    "context": {
        "id": "f2ed8763db1bcc4817ae9befd95a83f5",
        "parent_id": null,
        "user_id": null
    }
}
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:0d:6f:00:0e:1b:79:1a",
        "unique_id": "00:0d:6f:00:0e:1b:79:1a:3:0x0008",
        "device_id": "329556686e830cb76d019012e8664378",
        "endpoint_id": 3,
        "cluster_id": 8,
        "command": "move_to_level_with_on_off",
        "args": [
            254,
            10
        ]
    },
    "origin": "LOCAL",
    "time_fired": "2021-06-18T06:31:37.135071+00:00",
    "context": {
        "id": "f2ed8763db1bcc4817ae9befd95a83f5",
        "parent_id": null,
        "user_id": null
    }
}

pex81 avatar Jun 18 '21 06:06 pex81

Grazie. ;)

Ora aspettiamo Matteo...

alexdelprete avatar Jun 18 '21 10:06 alexdelprete

Ciao @pex81 @alexdelprete, sorry for the delay. Does the single center button press work?

You can test it with the following action config:

action_button_center_short:
- service: switch.toggle
  data:
    entity_id: switch.presa_iphone  

Thanks!

...and grazie @alexdelprete for helping out with the issue. ;)

EPMatt avatar Jun 21 '21 17:06 EPMatt

Ciao Matteo,

yes, the single press works. :)

Since I noticed it's the only controller I didn't give you the actions taken from me directly, but you got it indirectly, I thought it was better to record the events directly. I don't know if the problem is there.

Thanks for the help.

alexdelprete avatar Jun 21 '21 19:06 alexdelprete

Ciao @pex81 @alexdelprete, sorry for the delay. Does the single center button press work?

You can test it with the following action config:

action_button_center_short:
- service: switch.toggle
  data:
    entity_id: switch.presa_iphone  

Thanks!

...and grazie @alexdelprete for helping out with the issue. ;)

yes I confirm, single and long, it works. Only the double doesn't work.

pex81 avatar Jun 21 '21 19:06 pex81

Hi @alexdelprete @pex81, sorry for the delay.

I've just checked the blueprint and the code looks fine to me. I guess the issue might be with the controller not properly firing two separate events for the two presses only for the center button, when the two events are too close in time (I can see in the log @pex81 provided both events are fired with the same time_fired value). I faced similar issues while integrating some IKEA controllers.

Please try to wait a few moments between the first and second press and see if the desired action gets executed. If this operation triggers the single press action instead of the double one, try to increase the helper_double_press_delay value to 5+ seconds.

Thank you!

EPMatt avatar Jul 03 '21 21:07 EPMatt

Hi Matteo,

I will test it like you suggested. The only thing I can say is that when I didn't use your blueprint, the double press of the center button worked ok. Probably the configuration of the embedded automation of the controller works ok by default. Will let you know if the problem is solved playing with the configuration of the helper.

alexdelprete avatar Jul 04 '21 16:07 alexdelprete

Hi @EPMatt,

had some time to test finally. The double-press doesn't work, it always translated in a series of random single-presses. I also tried using helper_double_press_delay as suggested, in that case no single-presses generated, it simply did nothing.

The problem is also that with that value, single-press action of that button doesn't work anymore, obviously.

I reverted to long-press center button action, that one works perfectly.

alexdelprete avatar Jul 05 '21 16:07 alexdelprete

I also noticed another issue while I was testing: sometimes even the buttons that worked, single-press up and down, generated a bouncing effect (the action was repeated two times), so I decided to configure this, for each button:

image

I noticed that when I checked the checkbox, the "save" button of the automation would not appear, and it was strange, but after I unchecked, it appeared, so I re-enabled it and saved, but when I checked the automation again, the value was not saved.

alexdelprete avatar Jul 05 '21 16:07 alexdelprete

Hi @alexdelprete,

thank you so much for testing. Do you notice any entries in the HA logs related to this blueprint?

Could you also please share screenshots/traces from the HA automation trace tool? Set the helper_double_press_delay to 5000, then when trying to trigger the double press routine wait 1s between the first and second button press.

I noticed that when I checked the checkbox, the "save" button of the automation would not appear, and it was strange, but after I unchecked, it appeared, so I re-enabled it and saved, but when I checked the automation again, the value was not saved.

Interesting, where did you spot this bug? I guess it's in the ZHA device config.

Thank you!

EPMatt avatar Jul 07 '21 09:07 EPMatt

thank you so much for testing. Do you notice any entries in the HA logs related to this blueprint?

Not that I remember. I would've raised the issue. :)

Could you also please share screenshots/traces from the HA automation trace tool? Set the helper_double_press_delay to 5000, then when trying to trigger the double press routine wait 1s between the first and second button press.

I'll test later and report. I rarely used the automation trace tool, do you need something specific or just a couple of screenshots?

I noticed that when I checked the checkbox, the "save" button of the automation would not appear, and it was strange, but after I unchecked, it appeared, so I re-enabled it and saved, but when I checked the automation again, the value was not saved.

Interesting, where did you spot this bug? I guess it's in the ZHA device config.

Like I wrote (not clearly probably), it was in the edit of this automation: if I try to check these highlighted checkboxes, the automatic save button should appear, but it doesn't.

image

As soon as I uncheck one (or all of them), the save button appears.

image

The problem is that if I hit save, does checkboxes are not retained. It doesn't generate errors when I save, but when I go back in the automation, the three boxes are not checked.

In the logs I don't see relevant errors.

alexdelprete avatar Jul 07 '21 11:07 alexdelprete