Advertisement
Wykop

Zegarek kroki HA

Dec 23rd, 2022 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. W sensor.yalm
  2.  
  3. - platform: template
  4. sensors:
  5. person_kroki_zegarek:
  6. friendly_name: Person kroki zegarek
  7. icon_template: mdi:walk
  8. unit_of_measurement: "kroki"
  9. value_template: >
  10. {% set notif_sensor = 'sensor.sm_g975f_last_notification' %}
  11. {% if state_attr (notif_sensor, 'package') == 'com.huawei.health' %}
  12. {{ state_attr (notif_sensor, 'android.title') | regex_findall_index('.*? ',0) | regex_replace('\D','') }}
  13. {% endif %}
  14.  
  15. person_kalorie:
  16. friendly_name: Person kalorie
  17. icon_template: mdi:run-fast
  18. unit_of_measurement: "kcal"
  19. value_template: >
  20. {% set notif_sensor = 'sensor.sm_g975f_last_notification' %}
  21. {% if state_attr (notif_sensor, 'package') == 'com.huawei.health' %}
  22. {% if state_attr (notif_sensor, 'android.text') | regex_match('.*away') %}
  23. {{ state_attr (notif_sensor, 'android.title') | regex_findall_index('.*? ',2) | regex_replace('\D','') }}
  24. {% else %}
  25. {{ state_attr (notif_sensor, 'android.text') | regex_findall_index('.*? ',0) | regex_replace('\D','') }}
  26. {% endif %}
  27. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement