-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensors.yaml
70 lines (69 loc) · 2.64 KB
/
sensors.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
- platform: spotcast
scan_interval: 604800
# - platform: gramatus
# - platform: roomtoggles
# - platform: uptime
# name: Oppetid HA
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_utc'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
# See notes/tellstick.md for information on setting this up
- platform: tellstick
temperature_scale: "°C"
# datatype_mask: 1
only_named:
- id: 34
name: Kontoret
- id: 112
name: Stua
- id: 21
name: Ute
- id: 83
name: Kjøkkenet
- id: 135 # Channel 1
name: Soverommet
- id: 151 # Channel 2
name: Kjeller
- id: 167 # Channel 3
name: Gang nede
- id: 183 # Channel 4
name: Bad
- platform: template
sensors:
time_formatted:
friendly_name: "Date and time"
value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B %-m, %I:%M %p') }}"
icon_template: mdi:calendar-clock
# This can hopefully be used to set entity for my "playlist"-card based on what is currently active?
playing_entity:
friendly_name: "Currently active media player"
value_template: >-
{% set defaultEntity = "media_player.kjokkenet" %}
{% set inGroup = ['media_player.badet' , 'media_player.fm', 'media_player.kjokkenet', 'media_player.kontoret'] %}
{% set playState = "playing" %}
{% set group_state = states("media_player.Godehol") %}
{% set playingEntity = "" %}
{% set spotifySource = state_attr("media_player.spotify_gramatus","source") %}
{% for mediaPlayer in states.media_player %}
{% if state_attr(mediaPlayer.entity_id,"friendly_name") == spotifySource %}
{% set playingEntity = mediaPlayer.entity_id %}
{{ mediaPlayer.entity_id }}
{% endif %}
{% endfor %}
tid_til_vekking:
friendly_name: "Tid til vekking"
icon_template: mdi:alarm
value_template: >-
{% set nowTimestamp = as_timestamp(utcnow()) - as_timestamp(strptime(as_timestamp(utcnow())|timestamp_custom('%Y-%m-%d', true),'%Y-%m-%d')) %}
{% set alarmTimestamp = state_attr('input_datetime.vekking', 'timestamp') %}
{% if nowTimestamp > alarmTimestamp %}
{{ ((alarmTimestamp + (60*60*24)) - nowTimestamp) | timestamp_custom('%H:%M', false) }}
{% else %}
{{ (alarmTimestamp - nowTimestamp) | timestamp_custom('%H:%M', false)}}
{% endif %}