Updated instructions for creating sensors to avoid template loop

pull/22/head
EBOOZ 4 years ago
parent 105bb78c40
commit 33127d6cb3

@ -16,34 +16,28 @@ This solution is created to work with Home Assistant. It will work with any home
# Requirements # Requirements
* Create the three Teams sensors in the Home Assistant configuration.yaml file * Create the three Teams sensors in the Home Assistant configuration.yaml file
```yaml ```yaml
input_text:
teams_status:
name: Microsoft Teams status
icon: mdi:microsoft-teams
teams_activity:
name: Microsoft Teams activity
icon: mdi:phone-off
teams_monitoring:
name: Microsoft Teams monitoring
icon: mdi:api
sensor: sensor:
- platform: template - platform: template
sensors: sensors:
teams_status: teams_status:
friendly_name: "Microsoft Teams status" friendly_name: "Microsoft Teams status"
value_template: >- value_template: "{{states('input_text.teams_status')}}"
{% if is_state("binary_sensor.teams_monitoring", "off") -%} icon_template: "{{state_attr('input_text.teams_status','icon')}}"
Offline
{% else %}
{{ states('sensor.teams_status') }}
{% endif %}
icon_template: >-
{% if is_state("binary_sensor.teams_monitoring", "off") %}
mdi:microsoft-teams
{% endif %}
unique_id: sensor.teams_status unique_id: sensor.teams_status
teams_activity: teams_activity:
friendly_name: "Microsoft Teams activity" friendly_name: "Microsoft Teams activiteit"
value_template: >- value_template: "{{states('input_text.teams_activity')}}"
{% if is_state("binary_sensor.teams_monitoring", "off") -%}
Niet in gesprek
{% else %}
{{ states('sensor.teams_activity') }}
{% endif %}
icon_template: >-
{% if is_state("binary_sensor.teams_monitoring", "off") %}
mdi:phone-off
{% endif %}
unique_id: sensor.teams_activity unique_id: sensor.teams_activity
binary_sensor: binary_sensor:
@ -59,12 +53,9 @@ binary_sensor:
{% if noUpdateForMins > 5 %} {% if noUpdateForMins > 5 %}
off off
{% else %} {% else %}
{{ states('binary_sensor.teams_monitoring') }} {{states('input_text.teams_monitoring')}}
{% endif %}
icon_template: >-
{% if is_state("binary_sensor.teams_monitoring", "off") %}
mdi:api-off
{% endif %} {% endif %}
icon_template: "{{state_attr('input_text.teams_monitoring','icon')}}"
unique_id: binary_sensor.teams_monitoring unique_id: binary_sensor.teams_monitoring
``` ```
* Generate a Long-lived access token ([see HA documentation](https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token)) * Generate a Long-lived access token ([see HA documentation](https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token))

Loading…
Cancel
Save