Untitled

 avatar
user_4424989
plain_text
2 years ago
1.3 kB
6
Indexable
Never
- platform: template
  sensors:
    proxmox_ubuntu:
      friendly_name: Proxmox Ubuntu
      value_template: |
        {% set items = states.sensor.proxmox_resources.attributes.data | list | length %}
        {% set machine = "qemu/101" %}
        {% for i in range(items) %}
        {% if states.sensor.proxmox_resources.attributes.data[i].id == machine%}
        {{ states.sensor.proxmox_resources.attributes.data[i].status }}
        {% endif %}
        {% endfor %}
      attribute_templates:
        name: |
          {% set items = states.sensor.proxmox_resources.attributes.data | list | length %}
          {% set machine = "qemu/101" %}
          {% for i in range(items) %}
          {% if states.sensor.proxmox_resources.attributes.data[i].id == machine%}
          {{ states.sensor.proxmox_resources.attributes.data[i].name }}
          {% endif %}
          {% endfor %}
        id: |
          {% set items = states.sensor.proxmox_resources.attributes.data | list | length %}
          {% set machine = "qemu/101" %}
          {% for i in range(items) %}
          {% if states.sensor.proxmox_resources.attributes.data[i].id == machine%}
          {{ states.sensor.proxmox_resources.attributes.data[i].id }}
          {% endif %}
          {% endfor %}