Zigbee2mqtt passage en version 2.0.0 ( archive )

Bonjour @WarC0zes

Quel est intérêt de séparer les devises dans un autre fichier ?

En cas de rajout d’un appareil cela se fait automatiquement où il faut les déplacer manuellement dans le devis.yaml ?

Ou faut il mettre le devices.yaml ?
Faut il faire un include ?

Merci

Aucun. C’est la faute @Pulpy-Luke, j’ai vu sa configuration comme telle, ça m’a plu :joy:

C’est automatique, je ne suis pas maso :stuck_out_tongue:

Il faut mettre dans le configuration.yaml de Z2M:

devices:
  - devices.yaml

et le fichier devices.yaml dans le dossier /config/zigbee2mqtt
image

dans le fichier devices.yaml, c’est comme telle :

'0x00158d0007b0454d':
  friendly_name: Salon
  transition: 0
  filtered_attributes:
    - power_outage_memory
    - power_on_behavior
    - update_available
    - update
  homeassistant: {}
  legacy: false
  optimistic: true
'0x50325ffffe3029b7':
  friendly_name: Multiprise Séjour
'0xb4e3f9fffe780ffd':
  friendly_name: Prise Salle de bain

3 « J'aime »

Les montées de version zigbee2mqtt et zwavejs n’ont jamais été transparentes, ce serait étonnant que ce soit le cas, c’est ce qui entre autres m’a fait perdre patience à l’époque et m’a conduit à tester HA

1 « J'aime »

Les mêmes avantages que découper le configuration.yaml de ha…

J’ai quitté jeedom avant cette phrase là donc j’ai pas d’avis personnel là dessus.
Mais vu que c’est de l’enrobage, il est effectivement fort possible que ce ne soit pas neutre comme évolution.
Après tant que ça fonctionne avec l’ancienne méthode, jeedom n’a pas forcément besoin de basculer. Ça va juste être un souci pour le support du matériel pour les utilisateurs

1 « J'aime »

Personne ne parle de ça ?? vous n’avez pas besoin de le faire ??

En ce qui me concerne je ne comprend pas du tout de quoi tu parles …

On parle principalement de container dans les usages. Donc l’installation est toute faite.
Ne sont concernés que ceux qui installe/mettent à jour dans une vm

J’utilise HAOS donc dans une VM, où Z2M est un addon (en interne donc).
Suis-je concerné ?

Je ne pense pas, c’est dans le cas comme moi où Z2M est sur une VM séparée.

Suis-je le seul :cry:
WalkingKeanuReevesGIF

Dans une vm et installation manuelle… Pas avec vm avec container.
Quant à savoir si tu es, on dirait bien

Est ce que ça concerne les lxc type ttec script?
https://github.com/tteck/Proxmox/blob/main/install/zigbee2mqtt-install.sh

Moi je dirais que oui.
J’ai un pote qui est comme ça et quand on met à jour son Z2M on voit passer NPM, et des fois il faut le mettre à jour.

Moi je fais ça pour mettre a jour:

J’ai fait la même ce matin :-). Contagieux.

J’ai en plus un device.json… Me semble un héritage de Jeedom.

Après, Z2M est une dépendance de JeeZigbee. Ils n’ont qu’à geler les dépendances le temps de.

Oui comme moi et normalement dans les lignes de résultat il te parle de npm…

Pour tteck les scripts seront sûrement mis à jour.
Et au pire, nouvelle création, bascule de la configuration et basta

Rebonsoir
Pour ceux d’ici qui utilisaient les blueprint Hook - Light et - MediaPlayer de Awesome HA Blueprints avec un controller (E1744 pour mon cas) je partage les blueprints mis a jour pour fonctionner avec un MQTT_trigger.
Normalement ca fonctionne, mais c’est bien « Normalement » hahaha en tout cas c’est bon chez moi :wink:

Hook - Light
# Blueprint metadata
blueprint:
  name: Hook - Light
  description: |
    # Hook - Light

    Hook automation which allows to control a light. Supports brightness and color control both for white temperature and rgb lights. Features may vary depending on the selected Controller.

    An automation created with this blueprint must be linked to a [Controller](https://epmatt.github.io/awesome-ha-blueprints/blueprints/controllers) automation.
    Controllers are blueprints which allow to easily integrate a wide range of controllers (wall switches, remotes, dimmers, etc.) and use them to run a set of actions when interacting with them.
    They expose an abstract interface used by Hooks to create controller-based automations.

    A list of controllers supported by this hook is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light#supported-controllers).

    📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light).

    🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.

    ℹ️ Version 2022.07.30
  source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/hooks/light/light.yaml
  domain: automation
  input:
    integration:
      name: (Required) Integration
      description: Integration used for connecting the remote with Home Assistant. Select one of the available values.
      selector:
        select:
          options:
            - Zigbee2MQTT
            - Other
    controller_model:
      name: (Required) Controller model
      description: The model for the controller used in this automation. Choose a value from the list of supported controllers.
      selector:
        select:
          options:
            - IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote
            - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer
            - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer (#2)
            - IKEA E1744 SYMFONISK Rotary Remote
            - IKEA E1766 TRÅDFRI Open/Close Remote
            - IKEA E1766 TRÅDFRI Open/Close Remote (#2)
            - IKEA E1812 TRÅDFRI Shortcut button
            - IKEA E2001/E2002 STYRBAR Remote control
            - IKEA E2001/E2002 STYRBAR Remote control (#2)
            - IKEA ICTC-G-1 TRÅDFRI wireless dimmer
            - OSRAM AC025XX00NJ SMART+ Switch Mini
            - Philips 324131092621 Hue Dimmer switch
            - Philips 8718699693985 Hue Smart Button
            - Philips 929002398602 Hue Dimmer switch v2
            - SONOFF SNZB-01 Wireless Switch
            - Xiaomi WXCJKG11LM Aqara Opple 2 button remote
            - Xiaomi WXCJKG12LM Aqara Opple 4 button remote
            - Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2)
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2)
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3)
            - Xiaomi WXKG11LM Aqara Wireless Switch Mini
    controller_section:
      name: Controller options
      icon: mdi:light-switch
      collapsed: false
      input:
        controller_name:
          name: (Zigbee2MQTT) Controller Name
          description: Name of the device that will control the light. It must match the device name in the MQTT topic.
          default: ""
          selector:
            text:
        controller_device:
          name: (Other) Controller Device
          description: The controller device which will control the Light. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as a Device. This value should match the one specified in the corresponding Controller automation.
          default: ""
          selector:
            device:
        controller_entity:
          name: (Other) Controller Entity
          description: The controller entity which will control the Light. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as an Entity. This value should match the one specified in the corresponding Controller automation.
          default: ""
          selector:
            entity:
              domain: sensor
    light:
      name: (Required) Light
      description: Light which will be controlled with this automation.
      selector:
        entity:
          domain: light
    light_section:
      name: Light options
      icon: mdi:floor-lamp
      collapsed: true
      input:
        light_color_mode:
          name: (Optional) Light color mode
          description: Specify how the controller will set the light color. Choose "Color Temperature" and "Hue - Saturation" depending on the features supported by your light. If you are not sure you can select "Auto". "None" will disable color control features.
          default: Auto
          selector:
            select:
              options:
                - Auto
                - Color Temperature
                - Hue - Saturation
                - None
        light_transition:
          name: (Optional) Light Transition
          description: Number that represents the time (in milliseconds) the light should take turn on or off, if the light supports it.
          default: 250
          selector:
            number:
              min: 0
              max: 60000
              step: 1
              unit_of_measurement: milliseconds
              mode: box
        min_brightness:
          name: Light minimum brightness
          description: The minimum brightness the light can be set with this automation.
          default: 1
          selector:
            number:
              min: 1
              max: 255
              step: 1
              unit_of_measurement: brightness
              mode: slider
        max_brightness:
          name: Light maximum brightness
          description: The maximum brightness the light can be set with this automation.
          default: 255
          selector:
            number:
              min: 0
              max: 255
              step: 1
              unit_of_measurement: brightness
              mode: slider
        brightness_steps_short:
          name: Light brightness steps - short actions
          description: Number of steps from min to max brightness when controlling brightness with short actions (eg. button press).
          default: 10
          selector:
            number:
              min: 1
              max: 255
              step: 1
              unit_of_measurement: steps
              mode: box
        brightness_steps_long:
          name: Light brightness steps - long actions
          description: Number of steps from min to max brightness when controlling brightness with long actions (eg. button hold or controller rotation).
          default: 10
          selector:
            number:
              min: 1
              max: 255
              step: 1
              unit_of_measurement: steps
              mode: box
        force_brightness:
          name: Force brightness value at turn on
          description: Force brightness to the "On brightness" input value, when the light is being turned on.
          default: false
          selector:
            boolean:
        on_brightness:
          name: On brightness
          description: Brightness value to force when turning on the light
          default: 1
          selector:
            number:
              min: 0
              max: 255
              step: 1
              unit_of_measurement: brightness
              mode: slider
        smooth_power_on:
          name: Smooth power on
          description: Force the light to turn on at minimum brightness when a brightness up command (single or continuous) is triggered and light is off.
          default: true
          selector:
            boolean:
        smooth_power_off:
          name: Smooth power off
          description: Allow a brightness down command (single or continuous) to turn off the light when at minimum brightness. Disabling this will prevent the light from being turned off by brightness down commands.
          default: true
          selector:
            boolean:
# Automation schema
variables:
  # convert blueprint inputs into variables to be used in templates
  controller_model: !input controller_model
  integration: !input integration
  integration_id: "{{ integration | lower }}"
  # supported controllers and mappings
  controller_mapping:
    IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote:
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
      color_down: button_left_short
      color_down_repeat: button_left_long
      color_up: button_right_short
      color_up_repeat: button_right_long
      toggle: button_center_short
    IKEA E1743 TRÅDFRI On/Off Switch & Dimmer:
      turn_on: button_up_short
      brightness_up_repeat: button_up_long
      color_up: button_up_double
      turn_off: button_down_short
      brightness_down_repeat: button_down_long
      color_down: button_down_double
    IKEA E1743 TRÅDFRI On/Off Switch & Dimmer (#2):
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      turn_on: button_up_double
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
      turn_off: button_down_double
    IKEA E1744 SYMFONISK Rotary Remote:
      brightness_down: rotate_left
      brightness_up: rotate_right
      toggle: toggle
      color_up: brightness_step_up
      color_down: brightness_step_down
    IKEA E1766 TRÅDFRI Open/Close Remote:
      brightness_up: button_up_short
      turn_on: button_up_double
      brightness_down: button_down_short
      turn_off: button_down_double
    IKEA E1766 TRÅDFRI Open/Close Remote (#2):
      brightness_up: button_up_short
      color_up: button_up_double
      brightness_down: button_down_short
      color_down: button_down_double
    IKEA E1812 TRÅDFRI Shortcut button:
      toggle: button_short
      color_up: button_double
    IKEA E2001/E2002 STYRBAR Remote control:
      turn_on: button_up_short
      brightness_up_repeat: button_up_long
      turn_off: button_down_short
      brightness_down_repeat: button_down_long
      color_down: button_left_short
      color_down_repeat: button_left_long
      color_up: button_right_short
      color_up_repeat: button_right_long
    IKEA E2001/E2002 STYRBAR Remote control (#2):
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      turn_on: button_up_double
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
      turn_off: button_down_double
      color_down: button_left_short
      color_down_repeat: button_left_long
      color_up: button_right_short
      color_up_repeat: button_right_long
    IKEA ICTC-G-1 TRÅDFRI wireless dimmer:
      brightness_down_repeat: rotate_left
      brightness_up_repeat: rotate_right
    OSRAM AC025XX00NJ SMART+ Switch Mini:
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      color_up: button_up_double
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
      color_down: button_down_double
      toggle: button_center_short
    Philips 324131092621 Hue Dimmer switch:
      turn_on: button_on_short
      color_up_repeat: button_on_long
      turn_off: button_off_short
      color_down_repeat: button_off_long
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
    Philips 8718699693985 Hue Smart Button:
      toggle: button_short
    Philips 929002398602 Hue Dimmer switch v2:
      turn_on: button_on_short
      color_up_repeat: button_on_long
      turn_off: button_off_short
      color_down_repeat: button_off_long
      brightness_up: button_up_short
      brightness_up_repeat: button_up_long
      brightness_down: button_down_short
      brightness_down_repeat: button_down_long
    SONOFF SNZB-01 Wireless Switch:
      toggle: button_short
      color_up: button_double
    Xiaomi WXCJKG11LM Aqara Opple 2 button remote:
      turn_on: button_1_short
      brightness_up_repeat: button_1_long
      color_up: button_1_double
      turn_off: button_2_short
      brightness_down_repeat: button_2_long
      color_down: button_2_double
    Xiaomi WXCJKG12LM Aqara Opple 4 button remote:
      turn_on: button_1_short
      brightness_up_repeat: button_1_long
      color_up: button_1_double
      turn_off: button_2_short
      brightness_down_repeat: button_2_long
      color_down: button_2_double
    Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2):
      turn_on: button_3_short
      brightness_up_repeat: button_3_long
      color_up: button_3_double
      turn_off: button_4_short
      brightness_down_repeat: button_4_long
      color_down: button_4_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote:
      turn_on: button_1_short
      brightness_up_repeat: button_1_long
      color_up: button_1_double
      turn_off: button_2_short
      brightness_down_repeat: button_2_long
      color_down: button_2_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2):
      turn_on: button_3_short
      brightness_up_repeat: button_3_long
      color_up: button_3_double
      turn_off: button_4_short
      brightness_down_repeat: button_4_long
      color_down: button_4_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3):
      turn_on: button_5_short
      brightness_up_repeat: button_5_long
      color_up: button_5_double
      turn_off: button_6_short
      brightness_down_repeat: button_6_long
      color_down: button_6_double
    Xiaomi WXKG11LM Aqara Wireless Switch Mini:
      toggle: button_short
      color_up: button_double
  # pre-choose actions for buttons based on configured controller
  # no need to perform this task at automation runtime
  brightness_up: '{{ controller_mapping[controller_model]["brightness_up"] | default(None) }}'
  brightness_up_repeat: '{{ controller_mapping[controller_model]["brightness_up_repeat"] | default(None) }}'
  brightness_down: '{{ controller_mapping[controller_model]["brightness_down"] | default(None) }}'
  brightness_down_repeat: '{{ controller_mapping[controller_model]["brightness_down_repeat"] | default(None) }}'
  color_up: '{{ controller_mapping[controller_model]["color_up"] | default(None) }}'
  color_up_repeat: '{{ controller_mapping[controller_model]["color_up_repeat"] | default(None) }}'
  color_down: '{{ controller_mapping[controller_model]["color_down"] | default(None) }}'
  color_down_repeat: '{{ controller_mapping[controller_model]["color_down_repeat"] | default(None) }}'
  toggle: '{{ controller_mapping[controller_model]["toggle"] | default(None) }}'
  turn_on: '{{ controller_mapping[controller_model]["turn_on"] | default(None) }}'
  turn_off: '{{ controller_mapping[controller_model]["turn_off"] | default(None) }}'
  light_color_mode: !input light_color_mode
  light: !input light
  light_transition: !input light_transition
  min_brightness: !input min_brightness
  max_brightness: !input max_brightness
  brightness_steps_short: !input brightness_steps_short
  brightness_steps_long: !input brightness_steps_long
  force_brightness: !input force_brightness
  on_brightness: !input on_brightness
  smooth_power_on: !input smooth_power_on
  smooth_power_off: !input smooth_power_off
  color_modes:
    Auto: auto
    Color Temperature: color_temp
    Hue - Saturation: hs_color
    None: none
  # extract light color mode id
  light_color_mode_id: >-
    {%- if light_color_mode == "Auto" -%} {% set supported_color_modes = state_attr(light, "supported_color_modes") -%} {%- if "hs" in supported_color_modes or "xy" in supported_color_modes or "rgbw" in supported_color_modes or "rgbww" in supported_color_modes -%} {{
    color_modes["Hue - Saturation"] }} {%- elif "color_temp" in supported_color_modes -%} {{ color_modes["Color Temperature"] }} {%- else -%} {{ color_modes["None"] }} {%- endif -%} {%- else -%} {{ color_modes[light_color_mode] }} {%- endif -%}
  step_short: '{{ (max_brightness-min_brightness)/brightness_steps_short }}'
  step_long: '{{ (max_brightness-min_brightness)/brightness_steps_long }}'
mode: restart
max_exceeded: silent

trigger_variables:
  controller_name: !input controller_name

triggers:
  - platform: event
    event_type: ahb_controller_event
    event_data:
      controller: !input controller_device
  - platform: event
    event_type: ahb_controller_event
    event_data:
      controller: !input controller_entity
  - trigger: mqtt
    topic: "{{ 'zigbee2mqtt/' ~ controller_name ~ '/action' }}"

condition: []

actions:
  - variables:
      action: >-
        {%- if integration_id == "zigbee2mqtt" -%}
        {{ trigger.payload }}
        {%- elif integration_id == "other" -%}
        {{ trigger.event.data.action }}
        {%- endif -%}
  - choose:
      - conditions: '{{ action == toggle }}'
        sequence:
          - choose:
              - conditions: '{{ force_brightness }}'
                sequence:
                  - action: light.toggle
                    entity_id: !input light
                    data:
                      brightness: !input on_brightness
                      transition: '{{ light_transition / 1000 }}'
            default:
              - action: light.toggle
                entity_id: !input light
                data:
                  transition: '{{ light_transition / 1000 }}'
      - conditions: '{{ action == turn_on }}'
        sequence:
          - choose:
              - conditions: '{{ force_brightness }}'
                sequence:
                  - action: light.turn_on
                    entity_id: !input light
                    data:
                      brightness: !input on_brightness
                      transition: '{{ light_transition / 1000 }}'
            default:
              - action: light.turn_on
                entity_id: !input light
                data:
                  transition: '{{ light_transition / 1000 }}'
      - conditions: '{{ action == turn_off }}'
        sequence:
          - action: light.turn_off
            entity_id: !input light
            data:
              transition: '{{ light_transition / 1000 }}'
      - conditions: '{{ action == brightness_up }}'
        sequence:
          - choose:
              # if light is off and smooth power on is disabled, turn it on at the previously saved brightness
              - conditions: '{{ states(light) == "off" and not smooth_power_on}}'
                sequence:
                  - action: light.turn_on
                    data:
                      transition: '{{ light_transition / 1000 }}'
                      entity_id: !input light
              # if light is off and smooth power on is enabled, turn it on at minimum brightness
              - conditions: '{{ states(light) == "off" and smooth_power_on}}'
                sequence:
                  - action: light.turn_on
                    data:
                      brightness: '{{ min_brightness }}'
                      transition: '{{ light_transition / 1000 }}'
                      entity_id: !input light
            # else the light is on, hence increase its brightness
            default:
              - action: light.turn_on
                data:
                  brightness: '{{ [ [state_attr(light,"brightness")+step_short, min_brightness] | max, max_brightness] | min }}'
                  transition: 0.25
                  entity_id: !input light
      - conditions: '{{ action == brightness_down and states(light) == "on" }}'
        sequence:
          - choose:
              - conditions: '{{ smooth_power_off and state_attr(light,"brightness") == min_brightness }}'
                sequence:
                  - action: light.turn_off
                    data:
                      transition: '{{ light_transition / 1000 }}'
                      entity_id: !input light
            default:
              - action: light.turn_on
                data:
                  brightness: '{{ [ [state_attr(light,"brightness")-step_short, min_brightness] | max, max_brightness] | min }}'
                  transition: 0.25
                  entity_id: !input light
      - conditions: '{{ action == brightness_up_repeat }}'
        sequence:
          # first step for the smooth power on feature: subsequent steps can skip this check since light will be already on
          - choose:
              # if light is off and smooth power on is disabled, turn it on at the previously saved brightness
              - conditions: '{{ states(light) == "off" and not smooth_power_on}}'
                sequence:
                  - action: light.turn_on
                    data:
                      transition: '{{ light_transition / 1000 }}'
                      entity_id: !input light
                  - delay:
                      milliseconds: !input light_transition
              # if light is off and smooth power on is enabled, turn it on at minimum brightness
              - conditions: '{{ states(light) == "off" and smooth_power_on}}'
                sequence:
                  - action: light.turn_on
                    data:
                      brightness: '{{ min_brightness }}'
                      transition: '{{ light_transition / 1000 }}'
                      entity_id: !input light
                  - delay:
                      milliseconds: !input light_transition
          # else move on to the loop for increasing the light brightness
          - repeat:
              while: '{{ true }}'
              sequence:
                - action: light.turn_on
                  data:
                    brightness: '{{ [ [state_attr(light,"brightness")+step_long, min_brightness] | max, max_brightness] | min }}'
                    transition: 0.25
                    entity_id: !input light
                - delay:
                    milliseconds: 250
      - conditions: '{{ action == brightness_down_repeat and states(light) == "on"  }}'
        sequence:
          - choose:
              # using a separate sequence for the smooth power off feature to not perform unnecessary checks at every iteration when the feature is disabled
              - conditions: '{{ smooth_power_off }}'
                sequence:
                  - repeat:
                      # continue lowering brightness until the light turns off
                      while: '{{ states(light) != "off" }}'
                      sequence:
                        - choose:
                            # if the light is at minimum brightness, turn it off
                            - conditions: '{{ state_attr(light,"brightness") == min_brightness }}'
                              sequence:
                                - action: light.turn_off
                                  data:
                                    transition: '{{ light_transition / 1000 }}'
                                    entity_id: !input light
                                - delay:
                                    milliseconds: !input light_transition
                          # else lower the light's brightness
                          default:
                            - action: light.turn_on
                              data:
                                brightness: '{{ [ [state_attr(light,"brightness")-step_long, min_brightness] | max, max_brightness] | min }}'
                                transition: 0.25
                                entity_id: !input light
                            - delay:
                                milliseconds: 250
            default:
              - repeat:
                  # continue lowering brightness until the light turns off
                  while: '{{ states(light) != "off" }}'
                  sequence:
                    # lower the light's brightness. since smooth power off is disabled, never let the brightness move below the user-provided minimum
                    - action: light.turn_on
                      data:
                        brightness: '{{ [ [state_attr(light,"brightness")-step_long, min_brightness] | max, max_brightness] | min }}'
                        transition: 0.25
                        entity_id: !input light
                    - delay:
                        milliseconds: 250
      - conditions: '{{ action == color_up and light_color_mode_id != "none" }}'
        sequence:
          choose:
            - conditions: '{{ light_color_mode_id == "color_temp" }}'
              sequence:
                - action: light.turn_on
                  data:
                    color_temp: '{{ state_attr(light,"color_temp")|int + 50 }}'
                    transition: 0.25
                  entity_id: !input light
            - conditions: '{{ light_color_mode_id == "hs_color" }}'
              sequence:
                - action: light.turn_on
                  data:
                    hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) + 15) % 360, 100] }}'
                    transition: 0.25
                  entity_id: !input light
      - conditions: '{{ action == color_down and light_color_mode_id != "none" }}'
        sequence:
          choose:
            - conditions: '{{ light_color_mode_id == "color_temp" }}'
              sequence:
                - action: light.turn_on
                  data:
                    color_temp: '{{ [state_attr(light,"color_temp")|int - 50, 1]|max }}'
                    transition: 0.25
                  entity_id: !input light
            - conditions: '{{ light_color_mode_id == "hs_color" }}'
              sequence:
                - action: light.turn_on
                  data:
                    hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) - 15) % 360, 100] }}'
                    transition: 0.25
                  entity_id: !input light
      - conditions: '{{ action == color_up_repeat and light_color_mode_id != "none" }}'
        sequence:
          choose:
            - conditions: '{{ light_color_mode_id == "color_temp" }}'
              sequence:
                - repeat:
                    while: '{{ true }}'
                    sequence:
                      - action: light.turn_on
                        data:
                          color_temp: '{{ state_attr(light,"color_temp")|int + 50 }}'
                          transition: 0.25
                        entity_id: !input light
                      - delay:
                          milliseconds: 250
            - conditions: '{{ light_color_mode_id == "hs_color" }}'
              sequence:
                - repeat:
                    while: '{{ true }}'
                    sequence:
                      - action: light.turn_on
                        data:
                          hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) + 15) % 360, 100] }}'
                          transition: 0.25
                        entity_id: !input light
                      - delay:
                          milliseconds: 250
      - conditions: '{{ action == color_down_repeat and light_color_mode_id != "none" }}'
        sequence:
          choose:
            - conditions: '{{ light_color_mode_id == "color_temp" }}'
              sequence:
                - repeat:
                    while: '{{ true }}'
                    sequence:
                      - action: light.turn_on
                        data:
                          color_temp: '{{ [state_attr(light,"color_temp")|int - 50, 1]|max }}'
                          transition: 0.25
                        entity_id: !input light
                      - delay:
                          milliseconds: 250
            - conditions: '{{ light_color_mode_id == "hs_color" }}'
              sequence:
                - repeat:
                    while: '{{ true }}'
                    sequence:
                      - action: light.turn_on
                        data:
                          hs_color: '{{ [((state_attr(light,"hs_color")[0] or 0) - 15) % 360, 100] }}'
                          transition: 0.25
                        entity_id: !input light
                      - delay:
                          milliseconds: 250

Hook - Media Player
# Blueprint metadata
blueprint:
  name: Hook - Media Player
  description: |
    # Hook - Media Player

    Hook automation which allows to control a media player. Supports volume setting, play/pause and track selection. Features may vary depending on the selected Controller.

    An automation created with this blueprint must be linked to a [Controller](https://epmatt.github.io/awesome-ha-blueprints/blueprints/controllers) automation.
    Controllers are blueprints which allow to easily integrate a wide range of controllers (wall switches, remotes, dimmers, etc.) and use them to run a set of actions when interacting with them.
    They expose an abstract interface used by Hooks to create controller-based automations.

    A list of controllers supported by this hook is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/media_player#supported-controllers).

    📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/media_player).

    🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.

    ℹ️ Version 2022.07.30
  source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/hooks/media_player/media_player.yaml
  domain: automation
  input:
    integration:
      name: (Required) Integration
      description: Integration used for connecting the remote with Home Assistant. Select one of the available values.
      selector:
        select:
          options:
            - Zigbee2MQTT
            - Other
    controller_model:
      name: (Required) Controller model
      description: The model for the controller used in this automation. Choose a value from the list of supported controllers.
      selector:
        select:
          options:
            - IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote
            - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer
            - IKEA E1744 SYMFONISK Rotary Remote
            - IKEA E1766 TRÅDFRI Open/Close Remote
            - IKEA E1812 TRÅDFRI Shortcut button
            - IKEA E2001/E2002 STYRBAR Remote control
            - IKEA ICTC-G-1 TRÅDFRI wireless dimmer
            - OSRAM AC025XX00NJ SMART+ Switch Mini
            - Philips 324131092621 Hue Dimmer switch
            - Philips 8718699693985 Hue Smart Button
            - Philips 929002398602 Hue Dimmer switch v2
            - SONOFF SNZB-01 Wireless Switch
            - Xiaomi WXCJKG11LM Aqara Opple 2 button remote
            - Xiaomi WXCJKG12LM Aqara Opple 4 button remote
            - Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2)
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2)
            - Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3)
            - Xiaomi WXKG11LM Aqara Wireless Switch Mini
    controller_section:
      name: Controller options
      icon: mdi:remote
      collapsed: false
      input:
        controller_name:
          name: (Zigbee2MQTT) Controller Name
          description: Name of the device that will control the Media Player. It must match the device name in the MQTT topic.
          default: ''
          selector:
            text:
        controller_device:
          name: (Required) Controller Device
          description: The controller device which will control the Media Player. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as a Device. This value should match the one specified in the corresponding Controller automation.
          default: ''
          selector:
            device:
        controller_entity:
          name: (Required) Controller Entity
          description: The controller entity which will control the Media Player. Choose a value only if the integration used to connect the controller to Home Assistant exposes it as an Entity. This value should match the one specified in the corresponding Controller automation.
          default: ''
          selector:
            entity:
              domain: sensor
    media_player:
      name: (Required) Media Player
      description: Media player which will be controlled with this automation.
      selector:
        entity:
          domain: media_player
    media_player_section:
      name: Media Player options
      icon: mdi:speaker-multiple
      collapsed: true
      input:
        volume_steps_short:
          name: (Optional) Volume steps - short actions
          description: Number of steps from min to max volume when controlling volume with short actions (eg. button press), if the media player supports it.
          default: 10
          selector:
            number:
              min: 1
              max: 100
              step: 1
              unit_of_measurement: steps
              mode: box
        volume_steps_long:
          name: (Optional) Volume steps - long actions
          description: Number of steps from min to max volume when controlling volume with long actions (eg. button hold or controller rotation), if the media player supports it.
          default: 10
          selector:
            number:
              min: 1
              max: 100
              step: 1
              unit_of_measurement: steps
              mode: box
# Automation schema
variables:
  # convert blueprint inputs into variables to be used in templates
  controller_model: !input controller_model
  integration: !input integration
  integration_id: "{{ integration | lower }}"
  # supported controllers and mappings
  controller_mapping:
    IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote:
      volume_up: button_up_short
      volume_up_repeat: button_up_long
      volume_down: button_down_short
      volume_down_repeat: button_down_long
      prev_track: button_left_short
      next_track: button_right_short
      play_pause: button_center_short
      stop: button_center_long
    IKEA E1743 TRÅDFRI On/Off Switch & Dimmer:
      volume_up: button_up_short
      volume_up_repeat: button_up_long
      next_track: button_up_double
      volume_down: button_down_long
      play_pause: button_down_double
    IKEA E1744 SYMFONISK Rotary Remote:
      volume_down: rotate_left
      volume_up: rotate_right
      play_pause: toggle
      next_track: brightness_step_up
      prev_track: brightness_step_down
    IKEA E1766 TRÅDFRI Open/Close Remote:
      volume_up: button_up_short
      next_track: button_up_double
      volume_down: button_down_short
      play_pause: button_down_double
    IKEA E1812 TRÅDFRI Shortcut button:
      play_pause: button_short
      stop: button_long
      next_track: button_double
    IKEA E2001/E2002 STYRBAR Remote control:
      play_pause: button_up_short
      volume_up_repeat: button_up_long
      stop: button_down_short
      volume_down_repeat: button_down_long
      prev_track: button_left_short
      next_track: button_right_short
    IKEA ICTC-G-1 TRÅDFRI wireless dimmer:
      volume_down_repeat: rotate_left
      volume_up_repeat: rotate_right
    OSRAM AC025XX00NJ SMART+ Switch Mini:
      volume_up: button_up_short
      volume_up_repeat: button_up_long
      next_track: button_up_double
      volume_down: button_down_short
      volume_down_repeat: button_down_long
      prev_track: button_down_double
      play_pause: button_center_short
      toggle: button_center_long
    Philips 324131092621 Hue Dimmer switch:
      play_pause: button_on_short
      next_track: button_on_long
      stop: button_off_short
      prev_track: button_off_long
      volume_up: button_up_short
      volume_up_repeat: button_up_long
      volume_down: button_down_short
      volume_down_repeat: button_down_long
    Philips 8718699693985 Hue Smart Button:
      play_pause: button_short
      next_track: button_double
    Philips 929002398602 Hue Dimmer switch v2:
      play_pause: button_on_short
      next_track: button_on_long
      stop: button_off_short
      prev_track: button_off_long
      volume_up: button_up_short
      volume_up_repeat: button_up_long
      volume_down: button_down_short
      volume_down_repeat: button_down_long
    SONOFF SNZB-01 Wireless Switch:
      play_pause: button_short
      stop: button_long
      next_track: button_double
    Xiaomi WXCJKG11LM Aqara Opple 2 button remote:
      volume_up: button_1_short
      volume_up_repeat: button_1_long
      next_track: button_1_double
      volume_down: button_2_long
      play_pause: button_2_double
    Xiaomi WXCJKG12LM Aqara Opple 4 button remote:
      volume_up: button_1_short
      volume_up_repeat: button_1_long
      next_track: button_1_double
      volume_down: button_2_long
      play_pause: button_2_double
    Xiaomi WXCJKG12LM Aqara Opple 4 button remote (#2):
      volume_up: button_3_short
      volume_up_repeat: button_3_long
      next_track: button_3_double
      volume_down: button_4_long
      play_pause: button_4_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote:
      volume_up: button_1_short
      volume_up_repeat: button_1_long
      next_track: button_1_double
      volume_down: button_2_long
      play_pause: button_2_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#2):
      volume_up: button_3_short
      volume_up_repeat: button_3_long
      next_track: button_3_double
      volume_down: button_4_long
      play_pause: button_4_double
    Xiaomi WXCJKG13LM Aqara Opple 6 button remote (#3):
      volume_up: button_5_short
      volume_up_repeat: button_5_long
      next_track: button_5_double
      volume_down: button_6_long
      play_pause: button_6_double
    Xiaomi WXKG11LM Aqara Wireless Switch Mini:
      play_pause: button_short
      stop: button_long
      next_track: button_double
  # pre-choose actions for buttons based on configured controller
  # no need to perform this task at automation runtime
  volume_up: '{{ controller_mapping[controller_model]["volume_up"] | default(None) }}'
  volume_up_repeat: '{{ controller_mapping[controller_model]["volume_up_repeat"] | default(None) }}'
  volume_down: '{{ controller_mapping[controller_model]["volume_down"] | default(None) }}'
  volume_down_repeat: '{{ controller_mapping[controller_model]["volume_down_repeat"] | default(None) }}'
  next_track: '{{ controller_mapping[controller_model]["next_track"] | default(None) }}'
  prev_track: '{{ controller_mapping[controller_model]["prev_track"] | default(None) }}'
  stop: '{{ controller_mapping[controller_model]["stop"] | default(None) }}'
  play_pause: '{{ controller_mapping[controller_model]["play_pause"] | default(None) }}'
  toggle: '{{ controller_mapping[controller_model]["toggle"] | default(None) }}'
  volume_steps_short: !input volume_steps_short
  volume_steps_long: !input volume_steps_long
  media_player: !input media_player
  volume_step_value_short: '{{ 1/volume_steps_short }}'
  volume_step_value_long: '{{ 1/volume_steps_long }}'
mode: restart
max_exceeded: silent

trigger_variables:
  controller_name: !input controller_name

triggers:
  - trigger: event
    event_type: ahb_controller_event
    event_data:
      controller: !input controller_device
  - trigger: event
    event_type: ahb_controller_event
    event_data:
      controller: !input controller_entity
  - trigger: mqtt
    topic: "{{ 'zigbee2mqtt/' ~ controller_name ~ '/action' }}"

conditions: []

actions:
  - variables:
      action: >-
        {%- if integration_id == "zigbee2mqtt" -%}
        {{ trigger.payload }}
        {%- elif integration_id == "other" -%}
        {{ trigger.event.data.action }}
        {%- endif -%}
  - choose:
      - conditions: '{{ action == play_pause }}'
        sequence:
          - action: media_player.media_play_pause
            entity_id: !input media_player
      - conditions: '{{ action == stop }}'
        sequence:
          - action: media_player.media_stop
            entity_id: !input media_player
      - conditions: '{{ action == next_track }}'
        sequence:
          - action: media_player.media_next_track
            entity_id: !input media_player
      - conditions: '{{ action == prev_track }}'
        sequence:
          - action: media_player.media_previous_track
            entity_id: !input media_player
      - conditions: '{{ action == toggle }}'
        sequence:
          - action: media_player.toggle
            entity_id: !input media_player
      - conditions: '{{ action == volume_up }}'
        sequence:
          - choose:
              # if the volume level can be read from the media player, increase the volume by the custom step value
              - conditions: '{{ state_attr(media_player, "volume_level") != None }}'
                sequence:
                  - action: media_player.volume_set
                    entity_id: !input media_player
                    data:
                      volume_level: '{{ [ state_attr(media_player, "volume_level")+volume_step_value_short, 1 ] | min  }}'
            # if the volume level is not available, fallback to the media_player.volume_up service
            default:
              - action: media_player.volume_up
                entity_id: !input media_player
      - conditions: '{{ action == volume_down }}'
        sequence:
          - choose:
              # if the volume level can be read from the media player, decrease the volume by the custom step value
              - conditions: '{{ state_attr(media_player, "volume_level") != None }}'
                sequence:
                  - action: media_player.volume_set
                    entity_id: !input media_player
                    data:
                      volume_level: '{{ [ state_attr(media_player, "volume_level")-volume_step_value_short, 0 ] | max }}'
            # if the volume level is not available, fallback to the media_player.volume_down service
            default:
              - action: media_player.volume_down
                entity_id: !input media_player
      - conditions: '{{ action == volume_up_repeat }}'
        sequence:
          - repeat:
              while: '{{ true }}'
              sequence:
                - choose:
                    # if the volume level can be read from the media player, increase the volume by the custom step value
                    - conditions: '{{ state_attr(media_player, "volume_level") != None }}'
                      sequence:
                        - action: media_player.volume_set
                          entity_id: !input media_player
                          data:
                            volume_level: '{{ [ state_attr(media_player, "volume_level")+volume_step_value_long, 1 ] | min  }}'
                  # if the volume level is not available, fallback to the media_player.volume_up service
                  default:
                    - action: media_player.volume_up
                      entity_id: !input media_player
                - delay:
                    milliseconds: 250
      - conditions: '{{ action == volume_down_repeat }}'
        sequence:
          - repeat:
              while: '{{ true }}'
              sequence:
                - choose:
                    # if the volume level can be read from the media player, decrease the volume by the custom step value
                    - conditions: '{{ state_attr(media_player, "volume_level") != None }}'
                      sequence:
                        - action: media_player.volume_set
                          entity_id: !input media_player
                          data:
                            volume_level: '{{ [ state_attr(media_player, "volume_level")-volume_step_value_long, 0 ] | max }}'
                  # if the volume level is not available, fallback to the media_player.volume_down service
                  default:
                    - action: media_player.volume_down
                      entity_id: !input media_player
                - delay:
                    milliseconds: 250

2 « J'aime »

Bonjour,
J’ai réparé mon Zigbee2Mqtt en lisant et en compilant les fichiers qui ont été postés ici.
Mon fichier ci-dessous pour que cela fonctionne enfin :

homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://localhost
  include_device_information: true
serial:
  adapter: zstack
  port: /dev/ttyUSB0
frontend:
  port: 8081
advanced:
  homeassistant_legacy_entity_attributes: false
  homeassistant_legacy_triggers: false
  legacy_api: false
  legacy_availability_payload: false
  log_level: info
  log_syslog:
    app_name: Zigbee2MQTT
    eol: /n
    host: localhost
    localhost: localhost
    path: /dev/log
    pid: process.pid
    port: 514
    protocol: udp4
    type: '5424'
  last_seen: ISO_8601
  transmit_power: 20
device_options:
  legacy: false
devices:
  - devices.yaml
groups:
  - groups.yaml
ota:
  ikea_ota_use_test_url: false
  disable_automatic_update_check: false
availability:
  active:
    timeout: 10
  passive:
    timeout: 1500

Ajout :
homeassistant: true

au lieu de :
homeassistant:
legacy_triggers: false

1 « J'aime »