[AIDE] Tableau 24×7 avec cellules cliquables sans créer 168 entités

Suite à un échange avec djtef je poste une solution avec des cartes basiques et scripts HA

Je n’ai fait qu’une journée pour la démo sachant que je me suis concentré juste sur la logique d’affichage et non sur la carte elle même.

L’affichage est à base de carte mushroom template car c’est ce que j’avais sous la main mais la logique derrière est transposable à des custom-button-card.

J’ai un input_number par registre et 2 templates sensors (binaire, hex) qui ne sont la que pour le visuel et aider à la compréhension du fonctionnement et 1 script qui gère l’ensemble.

L’input number des registres :

Les templates sensor binaire et hexa :

Binaire

{{ "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join(' ') }}

Hexa

{{ '%02x'%  states('input_number.test_registre_31200')|int }}

Le rendu et fonctionnement :

registre pac

Le détail d’une carte :

type: custom:mushroom-template-card
icon: >-
  {% set registre_binary =
  "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
  ') %} {% if registre_binary.split(" ")[15] |int == 1 %}
    mdi:checkbox-blank
  {% else %}
    mdi:checkbox-blank-outline
  {% endif %}
features_position: bottom
color: >-
  {% set registre_binary =
  "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
  ') %} {% if registre_binary.split(" ")[15] |int == 1 %} green {% endif %}
tap_action:
  action: perform-action
  perform_action: script.test_registre
  target: {}
  data:
    num_registre: 31201
    valeur: 1
    split_value: 15
Le code complet de la page
type: sections
title: Test registre
cards: []
max_columns: 4
sections:
  - type: grid
    cards:
      - type: tile
        entity: input_number.test_registre_31201
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - type: tile
        entity: sensor.test_registre_31201_hex
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - type: custom:mushroom-empty-card
        grid_options:
          columns: 16
          rows: 1
      - type: tile
        entity: input_number.test_registre_31200
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - type: tile
        entity: sensor.test_registre_31200_hex
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - type: tile
        entity: sensor.test_registre_31201_binaire
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - type: custom:mushroom-empty-card
        grid_options:
          columns: 24
          rows: 1
      - type: tile
        entity: sensor.test_registre_31200_binaire
        vertical: false
        features_position: bottom
        grid_options:
          columns: 8
          rows: 1
      - square: true
        type: grid
        cards:
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              00h
              01h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              01h
              02h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              02h
              03h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              03h
              04h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              04h
              05h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              05h
              06h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              06h
              07h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              07h
              08h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              08h
              09h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              09h
              10h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              10h
              11h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              11h
              12h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              12h
              13h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              13h
              14h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              14h
              15h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              15h
              16h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              16h
              17h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              17h
              18h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              18h
              19h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              19h
              20h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              20h
              21h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              21h
              22h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              22h
              23h
            multiline_secondary: true
          - type: custom:mushroom-template-card
            features_position: bottom
            secondary: |-
              23h
              00h
            multiline_secondary: true
        columns: 24
        grid_options:
          columns: full
      - square: true
        type: grid
        cards:
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[15] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[15] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 1
                split_value: 15
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[14] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[14] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 2
                split_value: 14
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[13] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[13] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 4
                split_value: 13
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[12] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[12] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 8
                split_value: 12
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[11] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[11] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 16
                split_value: 11
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[10] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[10] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 32
                split_value: 10
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[9] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[9] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 64
                split_value: 9
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[8] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[8] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 128
                split_value: 8
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[7] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[7] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 256
                split_value: 7
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[6] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[6] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 512
                split_value: 6
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[5] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[5] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 1024
                split_value: 5
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[4] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[4] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 2048
                split_value: 4
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[3] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[3] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 4096
                split_value: 3
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[2] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[2] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 8192
                split_value: 2
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[1] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[1] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 16384
                split_value: 1
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[0] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31201')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[0] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31201
                valeur: 32768
                split_value: 0
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[15] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[15] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 1
                split_value: 15
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[14] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[14] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 2
                split_value: 14
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[13] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[13] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 4
                split_value: 13
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[12] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[12] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 8
                split_value: 12
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[11] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[11] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 16
                split_value: 11
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[10] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[10] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 32
                split_value: 10
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[9] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[9] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 64
                split_value: 9
          - type: custom:mushroom-template-card
            icon: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[8] |int == 1 %}
                mdi:checkbox-blank
              {% else %}
                mdi:checkbox-blank-outline
              {% endif %}
            features_position: bottom
            color: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_31200')|int(0))|batch(1)|map('join')|join('
              ') %} {% if registre_binary.split(" ")[8] |int == 1 %} green {%
              endif %}
            tap_action:
              action: perform-action
              perform_action: script.test_registre
              target: {}
              data:
                num_registre: 31200
                valeur: 128
                split_value: 8
        columns: 24
        grid_options:
          columns: full
    column_span: 4

Le script qui gère l’affichage et le calcul :

sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_'~num_registre)|int(0))|batch(1)|map('join')|join('
              ') %} {{ registre_binary.split(" ")[split_value] |int == 0 }}
        sequence:
          - action: input_number.set_value
            target:
              entity_id: input_number.test_registre_{{num_registre}}
            data:
              value: >-
                {{states('input_number.test_registre_'~num_registre)|int +
                valeur}}
      - conditions:
          - condition: template
            value_template: >-
              {% set registre_binary =
              "{:0=16b}".format(states('input_number.test_registre_'~num_registre)|int(0))|batch(1)|map('join')|join('
              ') %} {{ registre_binary.split(" ")[split_value] |int == 1 }}
        sequence:
          - action: input_number.set_value
            target:
              entity_id: input_number.test_registre_{{num_registre}}
            data:
              value: >-
                {{states('input_number.test_registre_'~num_registre)|int -
                valeur}}
description: ""
fields:
  valeur:
    selector:
      number:
        min: 1
        max: 65535
  split_value:
    selector:
      number:
        min: 0
        max: 15
  num_registre:
    selector:
      text: null
    name: num_registre
    required: true
alias: test - registre


Je suis parti d’une valeur décimale pour les inputs mais on peut très bien partir avec une valeur hexa. Pareil j’ai pris un input par registre mais on peut très bien concaténé tout pour avoir un input par journée (soit 2 registres).

3 « J'aime »