Skip to content

Feature/predefined actions with parameters - #220

Merged
xaviml merged 9 commits into
devfrom
feature/predefined-actions-with-parameters
Jan 10, 2021
Merged

Feature/predefined actions with parameters#220
xaviml merged 9 commits into
devfrom
feature/predefined-actions-with-parameters

Conversation

@xaviml

@xaviml xaviml commented Jan 9, 2021

Copy link
Copy Markdown
Owner

Resolves part of #173. It adds a new concept called Action types. They are similar to how actions/scripts are defined in HA. A full, but dummy config would be:

livingroom_test:
  log_level: DEBUG
  module: controllerx
  class: E1810Controller
  controller: livingroom_controller
  light: light.livingroom
  integration: 
    name: z2m
    listen_to: mqtt
  mapping:
    toggle:
        - service: light.turn_on
          entity_id: light.livingroom
          data:
            brightness: 150
        - on_min_brightness
        - delay: 5
        - on_full_brightness
        - scene: scene.my_scene

Now, we allow adding a list of actions with mixed types:

  • service: the keyword is service and entity_id and data are optional.
  • predefined actions: they can just be strings as we already had, or can be defined as action: <name of the action>
  • delay: Time in seconds to wait
  • scene: A shortcut to use service with scene.turn_on

Note that the actions will be executed sequentially and not in parallel, so if the actions are still being executed (such as waiting), and we fire them up again, the previous one will be cancelled and a new one will be executed. This is like the mode: restart from HA automations.

Keep in mind that if using predefined actions, it is not recommended to use a list of hold actions since they will be executed sequentially, and it will not result in an expected behaviour.

@xaviml

xaviml commented Jan 9, 2021

Copy link
Copy Markdown
Owner Author

Documentation for this new feature is missing.

@xaviml xaviml linked an issue Jan 10, 2021 that may be closed by this pull request
@xaviml
xaviml merged commit 9b87be3 into dev Jan 10, 2021
@xaviml
xaviml deleted the feature/predefined-actions-with-parameters branch January 10, 2021 15:14
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.

[FEATURE REQUEST] Ability to specify 2 actions for the same button

1 participant