Giter Site home page Giter Site logo

sian-lee-sa / home-assistant-switch-manager Goto Github PK

View Code? Open in Web Editor NEW
197.0 197.0 77.0 44.75 MB

Switch manager is a centralised component to handle button pushes for your wireless switches. This includes anything passed through the event bus. The component relies on switch blueprints which is easily made to allow GUI configuration of your switches and their button pushes. This helps remove clutter from the automations.

License: Other

Python 26.91% JavaScript 5.90% TypeScript 67.19%
component home-assistant script switch-manager

home-assistant-switch-manager's People

Contributors

alec-hs avatar bazmk2 avatar cdjm avatar chellweg avatar cs42 avatar dunkelschunkel avatar haraldpaulsen avatar harvindhillon avatar jhhbe avatar johro897 avatar lakitna avatar mr-groch avatar noxhirsch avatar nwithan8 avatar partemimperium avatar pieterdevriesch avatar ra72xx avatar robotanik avatar sammcj avatar scolby33 avatar sebli97 avatar sian-lee-sa avatar splattner avatar the-croz avatar tkpizza avatar tomhoogeveen avatar unthred avatar wrenoud avatar xavierg avatar zimmra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

home-assistant-switch-manager's Issues

aqara opple 3x2 hold

Hi @Sian-Lee-SA ,

I am observing a different hold as well as hold(release) behavior with the above device.
Long pressing gives 1 hold and after 2-3 seconds a hold release. Increasing a brightness for example results in just one execution of the service

In your video you are mentioning hold should be repeated

I can see both the button hold and automatically after 3 seconds the hold release in zigbee2mqtt as "action"

A hold until released would be great

Idea: Show configured buttons

Another idea came to my mind: Show which buttons are configured.
Icons (mdi:gesture-tap mdi:gesture-double-tap mdi:gesture-tap-hold) on the buttons show, which type of tap-action is configured. The icons would need to be very small since buttons can be very small and need to have an outline or background to be visible on dark and light switch pictures.

image

By the way: It's your project and your time - so it's all good if you don't like my ideas or don't care about them and close these issues without commenting on them!

zha intigation

Are there any plan`s to adapt zha or is it possible? Are there examples?

Universal MQTT button

I really need to be able to add a specific MQTT entity.
For example, I use ESP which passes button presses to MQTT and it would be great to be able to use this as buttons with click, double click, hold etc..

Support for xiaomi switch

Hi,
Possible to add support for xiaomi switch ?
I have the blueprint for all he xiaomi switch.
`blueprint:
name: Aqara Buttons All-In-One [Zigbee2MQTT]
description: 'All-In-One package for Aqara Switches.

Supports: WXKG11LM, WXKG12LM, WXKG03LM, WXKG06LM, WXKG07LM, WXKG02LM, QBKG03LM,
QBKG04LM, QBKG11LM, QBKG12LM, QBKG21LM, QBKG22LM, QBKG25LM, etc..).

Does not supports Opple.

Some actions may be unsupported by your switch. Check the available actions of
your device on zigbee2mqtt.io.

'

domain: automation
input:
action_sensor:
name: Action Sensor
description: Zigbee2mqtt action sensor
selector:
entity:
integration: mqtt
domain: sensor
multiple: false
single_action:
name: Single click
description: Simple clic pour interrupteur 1 bouton
default: []
selector:
action: {}
double_action:
name: Double Click
description: Double clic pour interrupteur 1 bouton
default: []
selector:
action: {}
triple_action:
name: Triple Clic
description: Triple click for devices with one button
default: []
selector:
action: {}
quadruple_action:
name: Quadruple Click
description: Triple click for devices with one button
default: []
selector:
action: {}
hold_action:
name: Hold Action
description: Hold action for devices with one button
default: []
selector:
action: {}
release_action:
name: Release Action
description: Release action for devices with one button
default: []
selector:
action: {}
shake_action:
name: Shake Action
description: Shake action for devices with one button
default: []
selector:
action: {}
single_left_action:
name: Single Left Click
description: Left click for devices with multiple buttons
default: []
selector:
action: {}
double_left_action:
name: Double Left Click
description: Double left click for devices with multiple buttons
default: []
selector:
action: {}
triple_left_action:
name: Triple Left Click
description: Triple left click for devices with multiple buttons
default: []
selector:
action: {}
hold_left_action:
name: Hold Left Action
description: Hold left action for devices with multiple buttons
default: []
selector:
action: {}
release_left_action:
name: Release Left Action
description: Release left action for devices with multiple buttons
default: []
selector:
action: {}
single_center_action:
name: Single Center Click
description: Center click for devices with three buttons
default: []
selector:
action: {}
double_center_action:
name: Double Center Click
description: Double center click for devices with three buttons
default: []
selector:
action: {}
triple_center_action:
name: Triple Center Click
description: Triple center click for devices with three buttons
default: []
selector:
action: {}
hold_center_action:
name: Hold Center Action
description: Hold center action for devices with three buttons
default: []
selector:
action: {}
release_center_action:
name: Release Center Action
description: Release center action for devices with three buttons
default: []
selector:
action: {}
single_right_action:
name: Single Right Click
description: Right click for devices with multiple buttons
default: []
selector:
action: {}
double_right_action:
name: Double Right Click
description: Double right click for devices with multiple buttons
default: []
selector:
action: {}
triple_right_action:
name: Triple Right Click
description: Triple right click for devices with multiple buttons
default: []
selector:
action: {}
hold_right_action:
name: Hold Right Action
description: Hold right action for devices with multiple buttons
default: []
selector:
action: {}
release_right_action:
name: Release Right Action
description: Release right action for devices with multiple buttons
default: []
selector:
action: {}
single_both_action:
name: Single Both Click
description: Both click for devices with multiple buttons
default: []
selector:
action: {}
double_both_action:
name: Double Both Click
description: Double both click for devices with multiple buttons
default: []
selector:
action: {}
triple_both_action:
name: Triple Both Click
description: Triple both click for devices with multiple buttons
default: []
selector:
action: {}
hold_both_action:
name: Hold Both Action
description: Hold both action for devices with multiple buttons
default: []
selector:
action: {}
release_both_action:
name: Release Both Action
description: Release both action for devices with multiple buttons
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/aqara-buttons-all-in-one-zigbee2mqtt/268717
mode: parallel
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'action_sensor'
action:

  • variables:
    command: '{{ trigger.to_state.attributes.action if trigger.to_state.state == "" else trigger.to_state.state }}'
  • choose:
    • conditions: '{{ command == ''single'' }}'
      sequence: !input single_action
    • conditions: '{{ command == ''double'' }}'
      sequence: !input double_action
    • conditions: '{{ command == ''triple'' }}'
      sequence: !input triple_action
    • conditions: '{{ command == ''quadruple'' }}'
      sequence: !input quadruple_action
    • conditions: '{{ command == ''hold'' }}'
      sequence: !input hold_action
    • conditions: '{{ command == ''release'' }}'
      sequence: !input release_action
    • conditions: '{{ command == ''shake'' }}'
      sequence: !input shake_action
    • conditions: '{{ command == ''single_left'' }}'
      sequence: !input single_left_action
    • conditions: '{{ command == ''double_left'' }}'
      sequence: !input double_left_action
    • conditions: '{{ command == ''triple_left'' }}'
      sequence: !input triple_left_action
    • conditions: '{{ command == ''hold_left'' }}'
      sequence: !input hold_left_action
    • conditions: '{{ command == ''release_left'' }}'
      sequence: !input release_left_action
    • conditions: '{{ command == ''single_center'' }}'
      sequence: !input single_center_action
    • conditions: '{{ command == ''double_center'' }}'
      sequence: !input double_center_action
    • conditions: '{{ command == ''triple_center'' }}'
      sequence: !input triple_center_action
    • conditions: '{{ command == ''hold_center'' }}'
      sequence: !input hold_center_action
    • conditions: '{{ command == ''release_center'' }}'
      sequence: !input release_center_action
    • conditions: '{{ command == ''single_right'' }}'
      sequence: !input single_right_action
    • conditions: '{{ command == ''double_right'' }}'
      sequence: !input double_right_action
    • conditions: '{{ command == ''triple_right'' }}'
      sequence: !input triple_right_action
    • conditions: '{{ command == ''hold_right'' }}'
      sequence: !input hold_right_action
    • conditions: '{{ command == ''release_right'' }}'
      sequence: !input release_right_action
    • conditions: '{{ command == ''single_both'' }}'
      sequence: !input single_both_action
    • conditions: '{{ command == ''double_both'' }}'
      sequence: !input double_both_action
    • conditions: '{{ command == ''triple_both'' }}'
      sequence: !input triple_both_action
    • conditions: '{{ command == ''hold_both'' }}'
      sequence: !input hold_both_action
    • conditions: '{{ command == ''release_both'' }}'
      sequence: !input release_both_action
      `

KNX support?

Hi,

Thanks you for sharing this awesome addon!
Would love to see knx support also ;) Would that be possible?

Best regards
Chris

Feature Request: Action layers

I was thinking about how switch manager feels just like setting up a game controller and realised that the similarities can go both ways. When setting up a steam controller you can define multiple "layers" with different settings or bindings as well as when they're activated. A very common example is changing bindings, gyroscope settings, or sensitivity when a trigger is partially depressed.

I feel like this would intuitively fit with Switch Manager.

For example I have a styrbar near my bed configured as a (basic) remote control for my media center. It would be fantastic if I could switch to a different set of controls to do other things with it, like turn off all the lights if I forgot something and don't want to get out of bed.

I think all that would be needed are the layers themselves, a next/previous control, and a programmatic way to directly active a given layer for a given switch. With that users could use existing systems like automations or node-red if they want state based controls, such as in my case having a media controller if kodi's active or home remote if it's not.

Mobile UI Issue

First of all many tanks for this awesome tool!

Screenshot_20230126_195131_Home Assistant.jpg

Would be great if the UI could be adjusted a little bit for the Home Assistant Android mobile app.

Aqara Opple 2/4/6 Button

Hello, can you maybe integrate the Aqara Opple with z2m? I see that these are listed with deconz but not with z2m.

That would be great!

MQTT integration discovery

Great work on the plugin.

I don't use Zigbee2MQTT but when I install this integration I get a "new integration found" for MQTT. If I click configure it asks for broker details (which I don't have). Is it possible to disable this or should I just ignore it?

Proposal: Agree on naming of actions in blueprints

Maybe it is a good idea to agree on the naming of actions:

Some blueprints use tap, double tap and hold.
Some use press, long press, long press (released).

This should be harmonized for all blueprints sooner or later.

I feel this component has a potential to join the HA core so there should be no blocking points for adding translation later on.
Or is it too early to think about such things?

Can't discover zigbee2mqtt switch

Hi, I'm trying to add new switch (based on new blueprint from #39), but auto discovery doesn't work (after I press discovery button only "Press a button on your switch" appears and nothing is happening after I'm pressing any button). Also when I enter mqtt topic manually - buttons on switch picture aren't highlighted when I press buttons on my remote...

In HA logs there are lot of this:

2023-01-03 10:09:20.340 ERROR (MainThread) [frontend.js.latest.202212131] https://hass.groch.cloud/switch_manager_panel.js?0.3.0:15304:6654 Uncaught TypeError: this._subscribed is not a function

Dot-menu partially hidden

Hi @Sian-Lee-SA,

I just love your integration so much and I wished more people know about it. Even with just one switch at the moment i am still amazed at what you've created to ease home assistant automation.
All that said, there is a rather obnoxious bug with the dot menu from which you can go to your variables or start debug functions. On smaller screen and on mobile this menu is hidden by the automation part of your integration. Rather annoying.
grafik
Screenshot tells the story.

Greetings from around the world.
Dunkelschunkel

Add configuration option for the integration to add the plattforms used

Hi,

I am just starting with your custom component and I really like it.
It is just something that I was thinking off (have a graphical user interface for buttons within HA), but I am no programmer so it was just a dream ... that came true now...

Just one idea right a the beginning.
Can you add a config dialog where you can select the plattforms that you are using so that the list gets filtered:

  • deCONZ
  • Google Nest
  • Homematic
  • Philips Hue
  • ZHA
  • Zigbee2MQTT
  • ZWave JS

So normally you are not using ZHA and Zigbee2MQTT --> Just disable the one you are not using...

data.button_last_state

I am trying to use data.button_last_state in order to repeat an action when a button is hold.
I can see in the debug that when a button is released:
data.button_last_state[0].action : {
"action": 1,
"title": "hold",
"timestamp": 1680176897.8251488
}
image

I have then tried to call this in the button actions without any success.

repeat:
  until:
    - condition: template
      value_template: "{{ data.button_last_state[0].title == 'hold' }}"
  sequence:
    - service: light.turn_on
      data:
        brightness_step_pct: 10
      target:
        entity_id: light.led_1
    - delay:
        hours: 0
        minutes: 0
        seconds: 1
        milliseconds: 0
enabled: true

If I understand your manual correct this is hown it should be done, but the loop never ends. Instead the loop goes on until i de-activate the code.

Feature Suggestion - Per Switch Device

It would be great to be able to define "global" device within each switch.

For example configuring a Hue Dimmer Switch you could select the single light or light group that would be used across the switch actions and accessed using some kind of variable.

This would allow for quicker initial configuration of a switch and also be great for setting up multiple switches with all the same actions but different devices.

How to build automations to handle a hold -> hold (release) cycle?

Hi,
first off; thanks for your awesome work putting together this project!

Now, I'm struggling to understand how I should build my scripts in the case where I need a hold (release) action to interrupt the hold action sequence. It's possible I've completely overlooked it in the documentation or in the countless of google searches I've done, but all I've seen is how to write the generic parts of the blueprint YAML for one specific device;
I would love to see some more documentation or examples on how to (best) utilize switch manager beyond just getting button triggers.

I have written blueprints for a 3 of my switches which weren't available yet - so I get that part at least.. =)

See below to get an idea on what I'm struggling with 😵‍💫 I've tried different variants of this - but I can't get the wait_for_trigger trigger to actually trigger!

Thanks in advance for any help!

- repeat:
    until: "{{ wait.trigger is not none or repeat.index >= 100 }}"
    sequence:
      - service: system_log.write
        data:
          message: Pretending to turn up brightness ... {{ repeat.index }}
      - wait_for_trigger:
          - platform: event
            event_type: zha_event
            event_data:
              device_id: "{{ data.device_id }}"
              command: stop_with_on_off
        timeout:
          milliseconds: 200

image

FR: Show visual feedback for pressed buttons in UI

Feature request:

Can you make the highlighted area flash a different color in the UI when the corresponding button is pressed?
This would add some useful feedback during creating blueprints or when configuring switches.

What do you think about this idea?

Zigbee2MQTT / Ikea On/Off Remote E1743 - 2 actions respond to 1 command

Issue is that hold (released) has the same MQTT action payload for release after on or off. So it will trigger both for on - hold (released) and off - hold (released) regardless what was released. Probably less confusing in code - see brightness_stop:

buttons:
  - x: 192
    y: 149
    width: 93
    actions:
      - title: press
        conditions:
          - key: payload
            value: "on"
      - title: hold
        conditions:
          - key: payload
            value: brightness_move_up
      - title: hold (released)
        conditions:
          - key: payload
            value: brightness_stop
  - x: 192
    y: 372
    width: 93
    actions:
      - title: press
        conditions:
          - key: payload
            value: "off"
      - title: hold
        conditions:
          - key: payload
            value: brightness_move_down
      - title: hold (released)
        conditions:
          - key: payload
            value: brightness_stop

Not sure what is the most elegant way to solve this? Zigbee2MQTT - Ikea SYMFONISK Sound remote (E1744) has a similar problem: it does not know if rotate (stop) is stopping after clockwise or counterclockwise rotation. On that one the approach is a single event ignoring sense of rotation, so it triggers only once independent of rotation sense.
An option might be to have a helper variable remember previous action but that (almost) pushes you back into automations while Switch Manager has been a great way to significantly reduce the number of automations I had.

Finally, this is not that wrong, but it may be confusing to users - after all the button is sending the same payload for 2 different actions. Issue is that now it is responding twice.

Any way to reduce number of new releases?

Not surprised people are interested in this and that new switches are added regularly. Would be great if new switches could be added without a new release and that new releases are reserved for additional functionality (not that I'm missing anything). Would be cool to split functionality versus content, though I understand it may sound like an unreasonable ask.

Very happy with the clean up in my automations as a result of installing this one!

Button highlight doesn't appear when swith has only one button

I've noticed that if swith has only one button, then it won't be higlighted in editor view, even when I've defined in yaml button position. I think that highlighting should appear for all definied buttons - it helps to check in editor if button is working

Allow reloading Blueprints without restart

Would it be possible to support reloading switch blueprints without restarting all of Home Assistant?

While experimenting and creating blueprints it can be incredibly slow to need to restart Home Assistant to test every change.

I suspect the component could selectively reload its own blueprints , and expose an option to do that in the UI?

Unable to see Hue Dimmer v1

Hi,

Another great tool, thank you...

After your response to my comment (Matt, 2 weeks ago) on your youtube video (https://www.youtube.com/watch?v=m2Rlobvo5cI&t=353s) I've tried and tried to get the v1 dimmer working but the switch manager never detects any presses. These are the steps I've tried.

  • Using Zigbee2MQTT / Philips Hue Dimmer v1/v2, autodetect finds nothing at all, after pressing all buttons, holding all buttons

image

  • Using the MQTT Tool, the button press is seen

image

  • Legacy is set to 'off' in MQTT settings, there are multiple places I can see legacy so I turned them all off first, then turned one on at a time and then restarting Zigbee2MQTT but still no change. I tried completely restarting HA, but still no change.
    Settings, Advanced tab
    image

Settings, Home Assistant tab
image

I don't know what else to try. My v2s are working ok but I've got some v1s that I'd love to be able to use.

This is my v1
image

Any guidance would be much appreciated if you have time.

Thanks, Matt

Shelly Gen 1, mqtt can't setup state topic

Trying to create blueprint for mqtt switch that publish physical state under topic:
shellies/+/input/0 and shellies/+/input/1 as payload 0 or 1. Verified multiple times that the topic name is correct:
image.
However , for some reason Switch Manager is not recognizing this topic no matter what i try. What is even more strange, when i set up mqtt topic for a switch with #, fe shellies/shellyswitch25-xxxxxxxxxxxx/# i can see messages in debug consoles from all other topics associated with this switch (/relay, /input_event, /temperature etc) but not for input/0 or input/1 .

MQTT documentation for this switch: https://shelly-api-docs.shelly.cloud/gen1/#shelly2-5-mqtt

name: Shelly 2.5 MQTT
service: Shelly
event_type: mqtt
mqtt_topic_format: shellies/+/input/#
buttons:
  - x: 110
    y: 123
    width: 66
    height: 66
    conditions: "{{ data.topic_basename == '0' }}"
    actions:
      - title: init
        conditions:
          - key: payload
            value: "1"
      - title: hold (released)
        conditions:
          - key: payload
            value: "0"

Idea: Hide device_id

I think the Switch Manager is an absolutely amazing UI, especially for beginners - thank you very much for creating it! The only thing that I think is not so relevant for beginners to be shown all the time is the cryptic device_id - especially since it is usually only set once.

To hide it, I have two ideas I want to suggest:
For both ideas create an entry in the menu (I replaced "disable" because I didn't know how to add an entry in the browser dev tools)
image

  1. When you create a new switch or click on the menu entry, this dialog pops up with a description (again I wasn't able to add it with dev tools) something like "This is the configured device id. You can change it manually or by clicking on 'FIND DEVICE' and then pressing a button on the device". The usage of 'FIND DEVICE' could be followed by a "waiting-for-a-button-press-dialog" and a "success---this-is-your-new-device-id-dialog".
    image
  2. A not-as-neat but maybe easier solution is to toggle the visibility of the existing device_id box with the menu entry. The input box would be hidden by default except after creating a new switch.

I'd be happy if you consider the idea, but can of course understand if you say it's too much work for a rather small change, or you just don't like the idea ;)

REQUEST: Tasmota support

I have a lot of switches like the Zemismart KS-811 3 Gang Switch which work via Tasmota (which in turn works through MQTT).
Are there any plans on adding Tasmota support?

YAML editor not showing up when using Safari

After a long-long search why I couldn't find the YAML editor when pressing "edit in YAML" or "variables" I figured out don't get the yaml input field at all when using Safari...

After a few hours of thinking I am just not looking in the right place I tried it in chrome and the field showed up...

Screenshot 2023-05-13 at 21 54 43 Screenshot 2023-05-13 at 21 55 27

- Feature request - Duplicate buttons within switches! - slightly different requirement than implemented

It's quite common for a switch with multiple buttons / functions will be controlling only one device.
maybe Lamp on / off / brightness up / down
so i'd like to copy the entities off the first button

For example - I've created a switch...
Programmed up the first button........

image

Now for the second function 'Click 2x', i'd like to 'copy first' or something similar
where the edit YAML is...

image

this saves repeatedly selecting 'device', 'tall lamp'...for all 5 of the functions on this switch
and i'm sure it'll save repeately selecting / populating the other 'actions' that are possible - as often, every button has a similar action that will need minor changing

it won't help for everyone, but it'll reduce the amount of button clicks / menu selections needed for a fair chunk of users

For example, when the user selects 'click2x', HOLD, ROTATE RIGHT, ROTATE LEFT - it's default page is blank and just has 'add action'
a 'duplicate previous' or 'duplicate 'select button to duplicate' context menu option like below
would populate each button with whatever was on the previous button

image

Hope that all makes sense, thankyou for the hard work on this, I'm hoping I can assist more as i learn more

Need Help working on ZHA Tradfri Remote

I got it working a little bit, but I'm not able to use "args" or "params" as conditions. Can someone help me with this problem?

Sadly ZHA only seperates the left and right button by these parameters:

Left Press:

event_type: zha_event
data:
  device_ieee: XXXXXXXXXXXXXXX
  unique_id: XXXXXXXXXXXXXXX
  device_id: XXXXXXXXXXXXXXX
  endpoint_id: 1
  cluster_id: 5
  command: press
  args:
    - 257
    - 13
    - 0
  params:
    param1: 257
    param2: 13
    param3: 0
origin: LOCAL
time_fired: "2023-01-07T08:58:36.536641+00:00"
context:
  id: XXXXXXXXXXXXXXX
  parent_id: null
  user_id: null

Right Press:

event_type: zha_event
data:
  device_ieee: XXXXXXXXXXXXXXX
  unique_id: XXXXXXXXXXXXXXX
  device_id: XXXXXXXXXXXXXXX
  endpoint_id: 1
  cluster_id: 5
  command: press
  args:
    - 256
    - 13
    - 0
  params:
    param1: 256
    param2: 13
    param3: 0
origin: LOCAL
time_fired: "2023-01-07T08:58:37.675986+00:00"
context:
  id: XXXXXXXXXXXXXXX
  parent_id: null
  user_id: null

Can someone help me with the right way to write these conditions? It's probably just a formatting issue.

Feature request: rotated installation

Sometimes I install light switches like the Opple switches at 90 deg to have two up/down buttons instead of of left/right buttons.

Can you add a button in the UI to rotate the switch blueprints?

Pull requests - new ZHA devices

Apologies, but I don't know how to use GitHub to facilitate a proper pull request.

Here are some ZHA devices I have created (used the images from the zigbee2mqtt versions)

Thank you for such a great plugin. Should be default within HA!

Only improvement would be a 'wizard' to create new switch types in the UI.

mycustom-zha-ikea-e1766.yaml

name: Ikea Open/Close Remote E1766
service: ZHA
event_type: zha_event
identifier_key: device_id
buttons:
  ## Those buttons only accept single tap actions
  - x: 182
    y: 90
    width: 65
    actions:
      - title: init
        conditions:
          - key: command
            value: up_open
      - title: hold (release)
        conditions:
          - key: command
            value: stop_opening
  - x: 182
    y: 280
    width: 65
    actions:
      - title: init
        conditions:
          - key: command
            value: down_close
      - title: hold (release)
        conditions:
          - key: command
            value: stop_closing

mycustom-zha-sonoff-snzb-01.yaml

name: Sonoff SNZB 01
service: ZHA
event_type: zha_event
identifier_key: device_id
buttons:
  - actions:
      - title: press
        conditions:
          - key: command
            value: toggle
      - title: press 2x
        conditions:
          - key: command
            value: "on"
      - title: hold
        conditions:
          - key: command
            value: "off"

mycustom-zha-xiaomi-smart-wireless-switch-wxkg01lm.yaml

name: Xiaomi Smart Wireless Switch (WXKG01LM)
service: ZHA
event_type: zha_event
identifier_key: device_id
buttons:
  - actions:
      - title: press
        conditions:
          - key: args.click_type
            value: single
      - title: press 2x
        conditions:
          - key: args.click_type
            value: double
      - title: press 3x
        conditions:
          - key: args.click_type
            value: triple
      - title: press 4x
        conditions:
          - key: args.click_type
            value: quadruple
      - title: press >4x
        conditions:
          - key: args.click_type
            value: furious
      - title: hold
        conditions:
          - key: command
            value: hold
      - title: hold (released)
        conditions:
          - key: command
            value: release

Support for calculating long press, and double tap for Keyboard Remote

Hello,

I've just started using this integration to help me manage my automations for the Keyboard Remote events. This component makes it so much easier to program the buttons!

However, the Keyboard Remote events only produce key_down and key_up events. In my automations I have logic to detect a long press and double tap by comparing the time differences between these events. Would it be possible to get some basic long and double press logic integrated for sources that may not natively support it?

I don't think it should be too difficult. A naive solution could be to maintain an in-memory map of recent button press events with timestamps and compare new incoming events to see if there is a long press (time delta between key_down and key_up > threshold) or double tap (time delta between two key_up events < threshold).

Thoughts?

Feature request: Global presets

Most of the light switches in my house are the same brands and models. Most of the time my switches are used for lights and not other automations or actions.

Can you add ‘Presets’ that can be assigned to multiple switches? This way I only need to program the default behaviour for each switch type that I have, instead of having to recreate a switch for each and every switch

Entity or Service to enable and disable switch.

I have a few light switches that do different things depending on the time of year or other conditions . The way I have it set up now is each switch has multiple automations and the seasonal automations will turn on or off the automations ID depending on what I wanted to do.

I would love either an entity for each switch manager switch or a service call to enable and a service call to disable a switch manager switch

New ZHA remote

Hi, sorry to open an issue for this but I can't fathom GitHub yet.

I have imported the following Tuya 4 button remove from zigbee2mqtt to ZHA
I have only confirmed working for the 3 button, but assume it will also work with the 4th button.

I am using the png from the zigbee2mgtt integration

name: TuYa 4 Button Scene (SS5300ZB)
service: ZHA
event_type: zha_event
identifier_key: device_id
buttons:
  - x: 66
    y: 102
    width: 32
    conditions:
      - key: endpoint_id
        value: 1
    actions:
      - title: press
        conditions:
          - key: command
            value: remote_button_short_press
      - title: press 2x
        conditions:
          - key: command
            value: remote_button_double_press
      - title: hold
        conditions:
          - key: command
            value: remote_button_long_press
  - x: 66
    y: 204
    width: 32
    conditions:
      - key: endpoint_id
        value: 2
    actions:
      - title: press
        conditions:
          - key: command
            value: remote_button_short_press
      - title: press 2x
        conditions:
          - key: command
            value: remote_button_double_press
      - title: hold
        conditions:
          - key: command
            value: remote_button_long_press
  - x: 66
    y: 302
    width: 32
    actions:
    conditions:
      - key: endpoint_id
        value: 3
    actions:
      - title: press
        conditions:
          - key: command
            value: remote_button_short_press
      - title: press 2x
        conditions:
          - key: command
            value: remote_button_double_press
      - title: hold
        conditions:
          - key: command
            value: remote_button_long_press
  - x: 66
    y: 405
    width: 32
    conditions:
      - key: endpoint_id
        value: 4
    actions:
      - title: press
        conditions:
          - key: command
            value: remote_button_short_press
      - title: press 2x
        conditions:
          - key: command
            value: remote_button_double_press
      - title: hold
        conditions:
          - key: command
            value: remote_button_long_press

New custom blueprints wont load

Hi, I'm trying to make copy of deconz-ikea-tradfri-remote but for zigbee2mqtt, so I've copied 2 files (yaml and png) and renamed to:

zigbee2mqtt-ikea-tradfri-remote.png
zigbee2mqtt-ikea-tradfri-remote.yaml

I've also changed content for zigbee2mqtt:

service: Zigbee2MQTT
event_type: mqtt
mqtt_topic_format: zigbee2mqtt/+/action

And also hanged all key to payload and value to correct mqtt action payloads

But this new switch isn't appearing in switch manager - I've tried many times reload service and HA restarts. There is nothing in logs for switch_manager domain (only setup start and end..)

zigbee2mqtt-ikea-tradfri-remote.zip

mqtt, won't work when json value in []array

Hello, trying to create blueprint for Shelly 2 PM connected via mqtt. However, values i need to use are in the [...] array in json payload, and it is not working. Sample mqtt payload:

{
    "src": "shellyplus2pm-b8d61a89b8c8",
    "dst": "shellyplus2pm-b8d61a89b8c8/events",
    "method": "NotifyEvent",
    "params": {
        "ts": 1684890281.22,
        "events": [
            {
                "component": "input:1",
                "id": 1,
                "event": "single_push",
                "ts": 1684890281.22
            }
        ]
    }
}

and my blueprint:

name: Shelly Plus 2pm mqtt
service: Shelly
event_type: mqtt
mqtt_topic_format: +/events/rpc
buttons:
  - x: 110
    y: 123
    width: 66
    height: 66
    conditions:
      - key: params.events[0].id
        value: 0
    actions:
      - title: tap
        conditions:
          - key: params.events[0].event
            value: single_push
      - title: hold
        conditions:
          - key: params.events[0].event
            value: long_push

UI configurable MQTT base topic

It would be great to have the MQTT base topic linked to a variable and configurable in the UI.
In the current state, If using something different than the default (E.G. zigbee2mqtt for z2mqtt ) in the integration, it is not really practical to use any of the default blueprints as the aforementioned base topic gets reset to default on every update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.