ZHA - Xiaomi Mijia Round Wireless Switch (WXKG01LM) - lumi.sensor_switch

Hello @Araforn!
First of all, thanks!

Second, thanks again, because you just noticed an issue with the blueprint hehe
In fact i tried adding 2 actions to the single/double click events, and the second action never executed.

That was due to the “Automation Mode” (Automation modes - Home Assistant), which was set to “restart”, and since the single/double click events actually trigger 2 “zha_event” events, the automation was restarted and never executed the subsequent actions.

I have changed it to “queued” here, and it is working fine, triggering multiple actions. I will fix that in a few minutes and updated the BP code; after that, i think if you reload your Automations, the BP will be fixed!

Thanks a lot again!

Hello,
I’ve updated the BP code, as mentioned before, but i actually changed the Automation Mode to parallel, instead of queued, to improve speed on possible multiple fast actions.
It might be interesting to have a drop-down in the BP to choose the Automation Mode. If anyone would like to have this feature, just let me know.

Hello!
First of all thank you for this great Blueprint. Very useful!
Blueprint works great except for “toggle” action on all my Yeelight Bulbs and light stripes. It only makes a very short flash instead of toggling le lights ON/OFF.
When using simple automatisation with same devices, the “toggle” works perfectly.
Do you know what could be the issue?
Thank you in advance.

Hello @Amine_Barhoumi!
Thanks.

Regarding your issue: are you using the “light.toggle” service, or the device actions?

Best regards.

@carlosmesquita
I am using the device action.
Here is my yaml code:

alias: CP_Switch_side_lights
description: ''
use_blueprint:
  path: >-
    carlosmesquita/zha-xiaomi-mijia-round-wireless-switch-wxkg01lm-lumi-sensor-switch.yaml
  input:
    mijia_round_switch: b7ed79099axxxxxxx32
    remote_button_short_press:
      - type: toggle
        device_id: cf94f0f08bcaxxxxxxx9cefd
        entity_id: light.192_168_1_19
        domain: light
    remote_button_hold_press:
      - type: turn_off
        device_id: 8c2d0292e1xxxxxxxxxxxx7a6e0f74
        entity_id: light.192_168_1_9
        domain: light
    remote_button_double_press:
      - type: turn_on
        device_id: 8c2d0292e14e293bdf6697a87a6e0f74
        entity_id: light.192_168_1_9
        domain: light

I also tried the light.toggle service with same issue.

Hello @Amine_Barhoumi!

I am using automations exactly like that, and it’s working fine…
Do you have other lights to test? To check it the issue is related to the Blueprint, or the lights?

@carlosmesquita
Hello,
I have tried with several types of light and it do the same even with my desk lamp.
I will try to check my integrations but it is really wired since I don’t have the problem with the “toggle” action with the same devices when I use simple automatisation rules.

@Amine_Barhoumi, have you checked if you have multiple Automations?
Check the Logbook entries, and if you want, share them here if you think there is something wrong!

Thank you for this @carlosmesquita, it works really well! :slight_smile:

Personally I think the minimum of 1 second to hold is too long though, especially because this controller has a built-in delay of about 350ms as well so I slightly changed to get more fine-grained control:

    holdtime:
      name: Time interval for hold detection, in seconds
      description: Time to wait until hold_press is activated
      default: 0.65
      selector:
        number:
          min: 0.15
          max: 2.5
          unit_of_measurement: seconds
          step: 0.05
          mode: slider
1 Like

Hello @jant90! Thanks :wink:

I was actually thinking about that in the past days… because i also think that 1s is too much! I have been lately testing lower values, and I am on around 500/600 ms.

Thanks a lot for your contribution, i will change the BP code to make it more flexible!

1 Like

Awesome, thanks for the quick update! :slight_smile:

1 Like

Thank you very much for that great blueprint!
However is it possible to add the possibility to dim a bulb (ex:100 > 0) while continuing hold the press button please? And if button released and again held > diming from 0 > 100?

Hi everyone!
Just a heads up, the blueprint seems to be affected by the fix, introduced in 21.04.05 and stopped working for me since then. The solution so far was to roll back on 21.04.04.
Similar issue.
P.S. Thanks for the great blueprint!

Thanks @Philou .
Regarding the ability to dim a light entity when continuing hold the button, I assume it is a good addition to this Blueprint, and will try to work on that when I got some spare time!

Hello @michael !

I am already on 21.04.05, and the Blueprint is working just fine for me!

Can you please check, on your local Blueprint file, if the Automation Mode is restart or parallel? I changed that a while ago, and maybe your Blueprint hasn’t updated yet…

I think that issue only applies to Automations running on restart mode, because they need to be stopped and started again, and the issue resides there.

Thanks :wink:

HI @carlosmesquita !
Thanks for the hint, it worked!
For some unknown reason I was thinking, that blueprints will pull updates automatically :slight_smile:

Good news @michael !

Yes, initially i just assumed that restarting Automations or Core would pull updates automatically, but aparently not… i had already noticed that when i performed previous updates on Blueprints. Not sure what the expected behaviour actually is!

Apparently, updates are planned in the future and once we will have it.
For the moment I ended up, erasing the content of Blueprint and dumping the actual version in. Worked perfectly well after HA restart.
Meanwhile, the issue was fixed in 2021.4.6, so it will work even with mode: restart :slight_smile:

1 Like

The updates will be awesome, to eliminate the need to “manually check for updates” on your Blueprints hehe

Actually, this Blueprint had an issue with restart, that’s why i changed it to parallel.
Check this answer.

Hello! I have used this blueprint and wireless switches, and they have worked fine. Untill now, “Hold” feature doesn’t work anymore. One click, two click etc. work well.

What I should do? What is problem with it?