Liczba uruchomionych / zatrzymanych usług

zrobiłem u siebie informację o aktualnych uruchomionych add-onach jednak chciałbym zrobić jakieś podsumowanie… ile jest aktualnie uruchomionych add-on a ile zatrzymanych. oczywiście raczej będzie to sensor template jednak nie mam pojęcia do tego podejść…
najlepiej jak by uruchomić licznik encji które będą miały na końcu dopisek running

binary_sensor.adguard_home_running
binary_sensor.duck_dns_running

z góry dziękuję za podpowiedź

Proszę pokaż całą encję np:
image
zakładam, że to sensor duck_dns a pozostałe informacje są w atrybutach encji?
Można zrobić group a poźniej zrobić sensor z ilością, poniżej przykład ile drzwi jest otwartych:

image

1 polubienie

Proszę bardzo :slight_smile: to multiple-entity-row- można tam w jednej lini wrzucać więcej opcji :slight_smile:


  - type: custom:fold-entity-row
    style: |
      :host div#items {
        margin: 0px 0px 0px -40px;
       }
    head:
      type: section
      label: Uruchomione usługi
    entities:
      - type: custom:fold-entity-row
        style: |
          :host div#items {
            margin: 0px 0px 0px -20px;
          }
        head:
          entity: binary_sensor.adguard_home_running
          type: custom:multiple-entity-row
          state_header: stan
          name: AdGuard Home
          entities:
            - entity: sensor.adguard_home_cpu_percent
              name: cpu
            - entity: sensor.adguard_home_memory_percent
              name: ram
        entities:
          - entity: sensor.adguard_home_version
            type: custom:multiple-entity-row
            state_header: aktualna
            name: Wersja
            entities:
              - entity: sensor.adguard_home_newest_version
                name: najnowsza

Nie chodziło o kartę w lovelace, tylko o własności encji (z narzędzi developerskich).
Nie mają dodatkowych atrybutów - po prostu każdy addon posiada kilka dodatkowych encji (zgodnie z trendem w HA gdzie obecnie tworzy się więcej prostych encji zamiast jednej napakowanej atrybutami, dzięki temu konfiguracja jest bardziej elastyczna - zbędne mogą być wyłączone).
@macek te encje pochodzą z integracji Supervisora (w żadnej produkcyjnej instalacji ich nie używam) i są domyślnie wyłączone, ale generalnie z tej grupy encji - wszystkie klasy “running” wyglądają tak (są to sensory binarne)
running_Screenshot 2022-01-21 at 14-44-14 Narzędzia deweloperskie - Home Assistant
więc twoje rozwiązanie z grupą moim zdaniem jest całkiem OK

@szopen dzięki za info, zapomiałem o tych encjach. Mozna zrobić tak:

  • stworzyć grupę:
doors:
  name: Doors
  icon: mdi:door
  entities:
    - binary_sensor.0x00158d00053fac0e_contact
    - binary_sensor.okno_sypialnia_contact
  • stworzyć sensor:
sensor:
  - platform: template
    sensors:
      open_door_count:
        value_template: >-
          {{expand('group.doors') | selectattr ('state','eq','on') | list | count }}
        icon_template: >
          {% if states.group.doors.state == 'off' %}
            mdi:door-closed
          {% elif states.group.doors.state == 'on' %}
            mdi:door-open
          {% else %}
            mdi:help
          {% endif %}

trzeba wpisać odpowiednie encje, poprawię to wieczorem teraz muszę uciekać

Dzięki wielkie @macek - jeżeli by ktoś chciał to wrzucam gotowe rozwiązanie :slight_smile:

image

image

image

GRUPA:

 uslugi_add_on:
  name: Ilość usług
  entities:
    - binary_sensor.adguard_home_running
    - binary_sensor.check_home_assistant_configuration_running
    - binary_sensor.duck_dns_running
    - binary_sensor.file_editor_running
    - binary_sensor.glances_running
    - binary_sensor.google_assistant_sdk_running
    - binary_sensor.let_s_encrypt_running
    - binary_sensor.mariadb_running
    - binary_sensor.mosquitto_broker_running
    - binary_sensor.nginx_home_assistant_ssl_proxy_running
    - binary_sensor.node_red_running
    - binary_sensor.phpmyadmin_running
    - binary_sensor.samba_backup_running
    - binary_sensor.samba_share_running
    - binary_sensor.spotify_connect_running
    - binary_sensor.tailscale_running
    - binary_sensor.zigbee2mqtt_running

Sensor template:


  - name: uslugi_add_on_count_on
    state: "{{expand('group.uslugi_add_on') | selectattr ('state','eq','on') | list | count }}"

  - name: uslugi_add_on_count_off
    state: "{{expand('group.uslugi_add_on') | selectattr ('state','eq','off') | list | count }}"


YAML dla jednej wartości, pozostałe do kopiuj wklej :slight_smile:


  - type: custom:fold-entity-row
    style: |
      :host div#items {
        margin: 0px 0px 0px -20px;
      }
    head:
      entity: group.uslugi_add_on
      type: custom:multiple-entity-row
      state_header: stan
      name: Uruchomione usługi
      entities:
        - entity: sensor.uslugi_add_on_count_on
          name: uruchomione
        - entity: sensor.uslugi_add_on_count_off
          name: zatrzymane
    entities:
      - type: custom:fold-entity-row
        style: |
          :host div#items {
            margin: 0px 0px 0px -20px;
          }
        head:
          entity: binary_sensor.adguard_home_running
          type: custom:multiple-entity-row
          state_header: stan
          name: AdGuard Home
          entities:
            - entity: sensor.adguard_home_cpu_percent
              name: cpu
            - entity: sensor.adguard_home_memory_percent
              name: ram
        entities:
          - entity: sensor.adguard_home_version
            type: custom:multiple-entity-row
            state_header: aktualna
            name: Wersja
            entities:
              - entity: sensor.adguard_home_newest_version
                name: najnowsza
1 polubienie