diff --git a/automations/hass/hass_update_group_entities.yaml b/automations/hass/hass_update_group_entities.yaml index 02f22f582..cafe4292c 100644 --- a/automations/hass/hass_update_group_entities.yaml +++ b/automations/hass/hass_update_group_entities.yaml @@ -98,6 +98,8 @@ entities: > {{ expand(integration_entities('hassio')) | selectattr('entity_id', 'contains', '_memory_percent') + | rejectattr('entity_id', 'in', ['sensor.home_assistant_core_memory_percent', + 'sensor.home_assistant_supervisor_memory_percent', 'sensor.hass_os_memory_percent']) | map(attribute='entity_id') | select('has_value') | list | sort }} @@ -107,6 +109,8 @@ entities: > {{ expand(integration_entities('hassio')) | selectattr('entity_id', 'contains', '_cpu_percent') + | rejectattr('entity_id', 'in', ['sensor.home_assistant_core_cpu_percent', + 'sensor.home_assistant_supervisor_cpu_percent', 'sensor.hass_os_cpu_percent']) | map(attribute='entity_id') | select('has_value') | list | sort }} diff --git a/templates/hass.yaml b/templates/hass.yaml index b512530dc..62feb84d6 100644 --- a/templates/hass.yaml +++ b/templates/hass.yaml @@ -302,7 +302,7 @@ - name: "HASS Addon CPU Percent" unique_id: hass_addon_cpu_percent - icon: mdi:memory + icon: mdi:chip state_class: measurement unit_of_measurement: "%" state: > @@ -312,3 +312,31 @@ {% set total.value = total.value + states(sensor.entity_id) | float %} {% endfor %} {{ '%0.1f' | format(total.value | float(0)) }} + + #NOTE assumption nothing else running on server + #ISSUE sensors don't update at same intervals, invalid values + - name: "HASS OS Memory Percent" + unique_id: hass_os_memory_percent + icon: mdi:memory + state_class: measurement + unit_of_measurement: "%" + state: > + {% set total = states('sensor.memory_use_percent') | float(0) %} + {% set core = states('sensor.home_assistant_core_memory_percent') | float(0) %} + {% set super = states('sensor.home_assistant_supervisor_memory_percent') | float(0) %} + {% set addon = states('sensor.hass_addon_memory_percent') | float(0) %} + {{ '%0.1f' | format(total - core - super - addon) | float }} + + #NOTE assumption nothing else running on server + #ISSUE sensors don't update at same intervals, invalid values + - name: "HASS OS CPU Percent" + unique_id: hass_os_cpu_percent + icon: mdi:chip + state_class: measurement + unit_of_measurement: "%" + state: > + {% set total = states('sensor.processor_use_percent') | float(0) %} + {% set core = states('sensor.home_assistant_core_cpu_percent') | float(0) %} + {% set super = states('sensor.home_assistant_supervisor_cpu_percent') | float(0) %} + {% set addon = states('sensor.hass_addon_cpu_percent') | float(0) %} + {{ '%0.1f' | format(total - core - super - addon) | float }} diff --git a/ui/bar/hass_memory_use_entity.yaml b/ui/bar/hass_memory_use_entity.yaml index ee4fe57b9..eae2ba145 100644 --- a/ui/bar/hass_memory_use_entity.yaml +++ b/ui/bar/hass_memory_use_entity.yaml @@ -2,7 +2,7 @@ ## HASS Memory Use Bar Entity ############################################################################### type: custom:bar-card -name: "HASS Memory" +name: "HASS Core Memory" entity: sensor.home_assistant_core_memory_percent entity_row: true icon: mdi:thermometer diff --git a/ui/bar/hass_os_memory_use_entity.yaml b/ui/bar/hass_os_memory_use_entity.yaml new file mode 100644 index 000000000..4fbe7d677 --- /dev/null +++ b/ui/bar/hass_os_memory_use_entity.yaml @@ -0,0 +1,34 @@ +############################################################################### +## HASS OS Memory Use Bar Entity +############################################################################### +type: custom:bar-card +name: "HASS OS Memory" +entity: sensor.hass_os_memory_percent +entity_row: true +icon: mdi:thermometer +positions: + icon: outside + name: outside + indicator: inside + value: outside +direction: right +height: 15px +width: 60% +decimal: 0 +min: 0 +max: 100 +severity: !include /config/ui/bar/include/memory_use_bar_color.yaml +card_mod: + class: bar_sub_card + style: | + :host { + --paper-item-icon-color: + {% set mem = states('sensor.hass_os_memory_percent') | int(-1) %} + {% if mem > 90 %} var(--entity-critical-color) + {% elif mem > 80 %} var(--entity-severe-color) + {% elif mem > 70 %} var(--entity-warning-color) + {% elif mem > 60 %} var(--entity-minor-color) + {% else %} var(--state-icon-color) + {% endif %} + ; + } diff --git a/ui/bar/hass_os_processor_use_entity.yaml b/ui/bar/hass_os_processor_use_entity.yaml new file mode 100644 index 000000000..f5880f31c --- /dev/null +++ b/ui/bar/hass_os_processor_use_entity.yaml @@ -0,0 +1,34 @@ +############################################################################### +## HASS OS CPU Use Bar Entity +############################################################################### +type: custom:bar-card +name: "HASS OS CPU" +entity: sensor.hass_os_cpu_percent +entity_row: true +icon: mdi:thermometer +positions: + icon: outside + name: outside + indicator: inside + value: outside +direction: right +height: 15px +width: 60% +decimal: 0 +min: 0 +max: 100 +severity: !include /config/ui/bar/include/processor_use_bar_color.yaml +card_mod: + class: bar_sub_card + style: | + :host { + --paper-item-icon-color: + {% set mem = states('sensor.hass_os_cpu_percent') | int(-1) %} + {% if mem > 90 %} var(--entity-critical-color) + {% elif mem > 80 %} var(--entity-severe-color) + {% elif mem > 70 %} var(--entity-warning-color) + {% elif mem > 60 %} var(--entity-minor-color) + {% else %} var(--state-icon-color) + {% endif %} + ; + } diff --git a/ui/bar/hass_processor_use_entity.yaml b/ui/bar/hass_processor_use_entity.yaml index 3d9608113..166e0bf9a 100644 --- a/ui/bar/hass_processor_use_entity.yaml +++ b/ui/bar/hass_processor_use_entity.yaml @@ -2,7 +2,7 @@ ## HASS Processor Use Bar Entity ############################################################################### type: custom:bar-card -name: "HASS CPU" +name: "HASS Core CPU" entity: sensor.home_assistant_core_cpu_percent entity_row: true icon: mdi:cpu-32-bit diff --git a/ui/card/hass/hass_monitor.yaml b/ui/card/hass/hass_monitor.yaml index cdd37d227..f0369ed53 100644 --- a/ui/card/hass/hass_monitor.yaml +++ b/ui/card/hass/hass_monitor.yaml @@ -7,9 +7,11 @@ icon: mdi:home-assistant show_header_toggle: false entities: - !include /config/ui/bar/hass_processor_use_entity.yaml - - !include /config/ui/bar/hass_memory_use_entity.yaml - !include /config/ui/bar/supervisor_processor_use_entity.yaml + - !include /config/ui/bar/hass_os_processor_use_entity.yaml + - !include /config/ui/bar/hass_memory_use_entity.yaml - !include /config/ui/bar/supervisor_memory_use_entity.yaml + - !include /config/ui/bar/hass_os_memory_use_entity.yaml - !include /config/ui/bar/disk_use_entity.yaml - entity: binary_sensor.remote_ui