Awtrix et monitoring de la conso électrique +production solaire + temperature + TEMPO Rouge

Salut,
Profitant du deal dealabs j’ai acquis Ulanzi TC001. J’y ai mis Awtrix et tout est devenu possible :grin:
Grace au ChatGPT :robot: j’au pu créer une belle automatisation qui permet de monitorer la consommation de l’éléctricité du réseau, la température extérieur et la production solaire dans un cycle de 40 secondes. La consommation de l’éléctricité du réseau est rafraichit toutes les 5 secondes pendant 30 secondes, ensuite j’affiche le température pendant 5 secondes et à la fin la production solaire ( uniquement quand la production > 3w, autrement j’affiche la consommation de l’éléctricité du réseau à la place).
Et la cerise sur le gâteau, j’indique également quand le tarif TEMPO est Rouge.
Franchement je suis hyper content car grace au ChatGPT on peut créer des automatisations qu’on aurait jamais pu faire sans cette aide (en tout cas pour ceux qui connaissent pas le code).
Je partage ici le code pour ceux qui voudrait s’en inspirer:

alias: awtrix display power, solar, temperature, Tempo
description: ""
trigger:
  - platform: time_pattern
    seconds: /5
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: |
              {{ (now().minute * 60 + now().second) % 40 < 30 }}
        sequence:
          - service: mqtt.publish
            data:
              qos: "0"
              topic: awtrix_3dd9e4/custom/solar
              payload_template: |
                {
                  "icon": "49776",
                  "text": "{{ states('sensor.pin_rest') | round }}W",
                  "duration": 5
                }
              retain: true
      - conditions:
          - condition: template
            value_template: >
              {{ (now().minute * 60 + now().second) % 40 >= 30 and (now().minute
              * 60 + now().second) % 40 < 35 }}
        sequence:
          - service: mqtt.publish
            data:
              qos: "0"
              topic: awtrix_3dd9e4/custom/solar
              payload_template: |
                {
                  "icon": "2056",
                  "text": "{{ states('sensor.lumi_ext_temperature') }}°C",
                  "duration": 5
                }
              retain: true
      - conditions:
          - condition: template
            value_template: >
              {{ (now().minute * 60 + now().second) % 40 >= 35 and (now().minute
              * 60 + now().second) % 40 < 40 }}
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: >
                      {{
                      states('sensor.envoy_122321034989_current_power_production')
                      | float > 3 }}
                sequence:
                  - service: mqtt.publish
                    data:
                      qos: "0"
                      topic: awtrix_3dd9e4/custom/solar
                      payload_template: |
                        {
                          "icon": "27283",
                          "text": "{{ states('sensor.envoy_122321034989_current_power_production') | round }}W",
                          "duration": 5
                        }
                      retain: true
              - conditions:
                  - condition: template
                    value_template: >
                      {{
                      states('sensor.envoy_122321034989_current_power_production')
                      | float <= 3 }}
                sequence:
                  - service: mqtt.publish
                    data:
                      qos: "0"
                      topic: awtrix_3dd9e4/custom/solar
                      payload_template: |
                        {
                          "icon": "49776",
                          "text": "{{ states('sensor.pin_rest') | round }}W",
                          "duration": 5
                        }
                      retain: true
  - choose:
      - conditions:
          - condition: template
            value_template: |
              {{ (now().minute * 60 + now().second) % 40 == 0 }}
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: sensor.tempo_aujourd_hui
                    state: TEMPO_ROUGE
                sequence:
                  - service: light.turn_on
                    target:
                      entity_id: light.awtrix_3dd9e4_indicator_1
                    data: {}
              - conditions:
                  - condition: not
                    conditions:
                      - condition: state
                        entity_id: sensor.tempo_aujourd_hui
                        state: TEMPO_ROUGE
                sequence:
                  - service: light.turn_off
                    target:
                      entity_id: light.awtrix_3dd9e4_indicator_1
                    data: {}
mode: single

Voici ce que ça donne:
Tempo

8 « J'aime »

hello merci pour le partage ,

pour ma part j’ai modifier en affectant 1 topic diffèrent a chaques affichage /solar /cptlinky /tempext et ca marche mieux , les valeurs ne se croisent pas dans le topic :slight_smile:

1 « J'aime »

Hello, pour ma gourverne, ca apporte quoi de d’affecter 1 topic diffèrent a chaques affichage /solar /cptlinky /tempext?

Je viens de revevoir mon ulanzi, je vais me lancer dans sa config.

Hello, si tu utilises 1 seul topic tu va écraser les valeurs dès que tu vas modifier ce topic. En faisant plusieurs topic, tu peux avoir un paramétrage ou un temps d’affichage différent par exemple.

1 « J'aime »

Merci.
Je comprends pas tout. Tu peux donner gentiment un exemple ou partager 2-3 automatisations de ton Ulanzi?
Merci par avance.

bonsoir,

J’ai fait cette automatisation :

alias: Awtrix - data - 05min
description: ""
trigger:
  - platform: time_pattern
    minutes: /5
condition: []
action:
  - metadata: {}
    data:
      qos: 0
      retain: false
      topic: awtrix_a9b41c/custom/consohier
      payload: >-
        { icon: "21520",  scrollSpeed: 40,lifetime: 65, repeat: 2 ,text: " Conso
        hier : {{((states('sensor.select_sql_query')))}} Kwh - HP :
        {{((states('sensor.heure_pleine_j_1')))}} Kwh - HC :
        {{((states('sensor.heure_creuse_j_1')))}} Kwh"}
    action: mqtt.publish
mode: single

cela affiche la conso électrique de la veille toutes les 5 minutes. 

Ou celui la qui affiche la fin de la machine à laver :

alias: "AWTRIX : fin machine à laver"
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.prise_zigbee_orange_3_puissance
    below: 1
condition: []
action:
  - if:
      - condition: state
        entity_id: input_boolean.machine_a_laver
        state: "off"
    then:
      - target:
          entity_id:
            - input_boolean.machine_a_laver
        data: {}
        action: input_boolean.turn_on
      - metadata: {}
        data:
          message: Démarrage Machine à laver
        action: telegram_bot.send_message
    else:
      - metadata: {}
        data:
          message: Machine à laver terminée
        action: telegram_bot.send_message
      - metadata: {}
        data:
          qos: 0
          retain: false
          topic: awtrix_a9b41c/custom/slinge
          payload: "{  icon: \"24504\", lifetime: 600, text: \"Machine a laver termine\"}"
        action: mqtt.publish
      - target:
          entity_id: input_boolean.machine_a_laver
        data: {}
        action: input_boolean.turn_off
mode: single

J’espère que cela pourra t’aider

hello @Laurent_Vaugeois
Pourrais tu mettre ton code entre les balises stp ?

hello
C’est fait.
cordialement

désolé je n’avais pas vu les messages mais laurent a donné la réponse merci a lui

1 « J'aime »

Ma petite contribution qui donne ceci :

  • Le jour :
    AWTRIX_JOUR
  • La nuit :
    awtrix (3)

=> En haut à droite => Couleur actuelle TEMPO
=> En bas à droite => Prochaine couleur TEMPO

Automatisation Principale - Affichage Temperature, Production, Conso, Gain de facture
alias: Afficheur AWTRIX - Temperature, Production, Conso, Gain de facture
trigger:
  - platform: time_pattern
    seconds: /15
condition: []
action:
  - variables:
      seuil_prod_min: 0.1
      seuil_gain_min: 1.0
      current_screen: >
        {% if now().second >= 0 and now().second <= 14 %} 0 {% elif now().second
        >= 15 and now().second <= 29 %} 1 {% elif now().second >= 30 and
        now().second <= 44 %} 2 {% elif now().second >= 45 and now().second <=
        59 %} 3 {% endif %}
      daily_solar_energy: "{{ states('sensor.daily_solar_energy') | float }}"
      daily_grid_energy_imported: "{{ states('sensor.daily_grid_energy_imported') | float }}"
      daily_grid_energy_exported: "{{ states('sensor.daily_grid_energy_exported') | float }}"
      production: "{{ (states('sensor.solaire_power') | float / 1000) | round(1) }}"
      conso: "{{( states('sensor.enedis_power') | float / 1000 )| round(1)}}"
      temp_ext: "{{ (states('sensor.temperature_jardin') | float) | round(1) }}"
      gain_percentage: >
        {{ ((daily_solar_energy-daily_grid_energy_exported) /
        (daily_grid_energy_imported+(daily_solar_energy-daily_grid_energy_exported))
        * 100) | round(0) }}
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 0 }}"
        sequence:
          - data:
              topic: awtrix_2d9594/custom/HomeAssistant
              payload: |
                {
                  "icon": "2355",
                  "text": "{{ temp_ext }}°C",
                  "duration": 2
                }
            action: mqtt.publish
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 1 }}"
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ production < seuil_prod_min }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "62775",
                          "text": "0 kW",
                          "duration": 2
                        }
                    action: mqtt.publish
              - conditions:
                  - condition: template
                    value_template: "{{ production >= seuil_prod_min }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "62774",
                          "text": "{{ production }}kW",
                          "duration": 2
                        }
                    action: mqtt.publish
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 2 }}"
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ conso <= 0 }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "62777",
                          "text": "{{ -conso }}kW",
                          "duration": 2
                        }
                    action: mqtt.publish
              - conditions:
                  - condition: template
                    value_template: "{{ conso > 0 }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "62776",
                          "text": "{{ conso }}kW",
                          "duration": 2
                        }
                    action: mqtt.publish
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 3 }}"
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ gain_percentage <= seuil_gain_min }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "25681",
                          "text": "0 %",
                          "duration": 2
                        }
                    action: mqtt.publish
              - conditions:
                  - condition: template
                    value_template: "{{ gain_percentage > seuil_gain_min }}"
                sequence:
                  - data:
                      topic: awtrix_2d9594/custom/HomeAssistant
                      payload: |
                        {
                          "icon": "25681",
                          "text": "{{ -gain_percentage }} %",
                          "duration": 2
                        }
                    action: mqtt.publish
mode: single

Automatisation Secondaire - Affichage des couleurs TEMPO
alias: Afficheur AWTRIX - Affichage des couleurs TEMPO
trigger:
  - platform: time_pattern
    seconds: /30
condition: []
action:
  - variables:
      current_screen: >
        {% if now().second >= 0 and now().second <= 29 %} 0 {% elif now().second
        >= 30 and now().second <= 59 %} 1 {% endif %}
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 0 }}"
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_couleur_actuelle
                    state: Rouge
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_1
                      rgb_color:
                        - 255
                        - 0
                        - 0
                    action: light.turn_on
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_couleur_actuelle
                    state: Bleu
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_1
                      rgb_color:
                        - 0
                        - 0
                        - 255
                    action: light.turn_on
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_couleur_actuelle
                    state: Blanc
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_1
                      rgb_color:
                        - 255
                        - 255
                        - 255
                    action: light.turn_on
              - conditions:
                  - condition: not
                    conditions:
                      - condition: state
                        entity_id: sensor.rte_tempo_couleur_actuelle
                        state: Rouge
                      - condition: state
                        entity_id: sensor.rte_tempo_couleur_actuelle
                        state: Bleu
                      - condition: state
                        entity_id: sensor.rte_tempo_couleur_actuelle
                        state: Blanc
                sequence:
                  - target:
                      entity_id: light.awtrix_2d9594_indicator_1
                    action: light.turn_off
                    data: {}
      - conditions:
          - condition: template
            value_template: "{{ current_screen == 1 }}"
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_prochaine_couleur
                    state: Rouge
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_3
                      rgb_color:
                        - 255
                        - 0
                        - 0
                    action: light.turn_on
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_prochaine_couleur
                    state: Bleu
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_3
                      rgb_color:
                        - 0
                        - 0
                        - 255
                    action: light.turn_on
              - conditions:
                  - condition: state
                    entity_id: sensor.rte_tempo_prochaine_couleur
                    state: Blanc
                sequence:
                  - data:
                      entity_id: light.awtrix_2d9594_indicator_3
                      rgb_color:
                        - 255
                        - 255
                        - 255
                    action: light.turn_on
              - conditions:
                  - condition: not
                    conditions:
                      - condition: state
                        entity_id: sensor.rte_tempo_prochaine_couleur
                        state: Rouge
                      - condition: state
                        entity_id: sensor.rte_tempo_prochaine_couleur
                        state: Bleu
                      - condition: state
                        entity_id: sensor.rte_tempo_prochaine_couleur
                        state: Blanc
                sequence:
                  - target:
                      entity_id: light.awtrix_2d9594_indicator_3
                    action: light.turn_off
                    data: {}
mode: single

Automatisation Secondaire - Vérification de l'affichage du bon écran
alias: Afficheur AWTRIX - Vérification de l'affichage du bon écran
description: ""
trigger:
  - platform: time_pattern
    seconds: "30"
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.awtrix_2d9594_current_app
        state: HomeAssistant
action:
  - action: button.press
    metadata: {}
    data: {}
    target:
      entity_id: button.awtrix_2d9594_next_app
mode: single

2 « J'aime »

merci, j’y ai pas pensé de mettre tempo le lendemain et j’ai une led de dispo, thx.

De rien.

J’ai aussi fait des logo perso plus compréhensible que ceux dispo dans la librairie de base :

  • Energie solaire => JOUR + NUIT
  • Conso depuis le réseaux => IMPORT + EXPORT
    image
2 « J'aime »