Ludovic Laly, mon blog

12:26

Gérer les Qubino Flush Pilot Wire dans Home Asistant

Le module fil pilote de Qubino se comporte comme une lumière dimmable
La doc donne pour valeur :
00 - 10 Stop
11 - 20 Hors-gel
21 - 30 Eco
31 - 40 Confort -2
41 - 50 Confort -1
51 - 99 Confort

Le "problème" c'est que Home assistant utilise une échelle de 0 à 255 pour l'attribut brightness
voici donc comment je procède :

Tout d'abords un champ déroulant avec les états possible

input_select:
  bathroom_radiator:
    name: Radiateur
    icon: mdi:radiator
    options:
     - Arrêt
     - Hors-gel
     - Eco
     - Confort -2
     - Confort -1
     - Confort

Et enfin dans mes "automation"

automation:
  - alias: 'Radiateur salle de bain'
    trigger:
      platform: state
      entity_id: input_select.bathroom_radiator
    action:
      entity_id: light.bathroom_radiator_43
      service_template: >
        {% if is_state("input_select.bathroom_radiator", "Confort") %}
          light.turn_on
        {% elif is_state("input_select.bathroom_radiator", "Confort -1") %}
          light.turn_on
        {% elif is_state("input_select.bathroom_radiator", "Confort -2") %}
          light.turn_on
        {% elif is_state("input_select.bathroom_radiator", "Eco") %}
          light.turn_on
        {% elif is_state("input_select.bathroom_radiator", "Hors-gel") %}
          light.turn_on
        {% elif is_state("input_select.bathroom_radiator", "Arret") %}
          light.turn_off
        {% else %}
          light.turn_off
        {% endif %}
      data_template:
        brightness: >
          {% if is_state("input_select.bathroom_radiator", "Confort") %}
            130
          {% elif is_state("input_select.bathroom_radiator", "Confort -1") %}
            105
          {% elif is_state("input_select.bathroom_radiator", "Confort -2") %}
            79
          {% elif is_state("input_select.bathroom_radiator", "Eco") %}
            54
          {% elif is_state("input_select.bathroom_radiator", "Hors-gel") %}
            28
          {% elif is_state("input_select.bathroom_radiator", "Arret") %}
            0
          {% else %}
            0
          {% endif %}