forked from matt8707/hass-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.yaml
849 lines (732 loc) · 28.9 KB
/
configuration.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
homeassistant:
name: Hem
latitude: !secret homeassistant_latitude
longitude: !secret homeassistant_longitude
elevation: !secret homeassistant_elevation
unit_system: metric
time_zone: Europe/Stockholm
customize: !include customize.yaml
whitelist_external_dirs:
- '/config/'
auth_providers:
- type: trusted_networks
trusted_networks:
- 192.168.0.0/24
- 192.168.0.10
allow_bypass_login: true
default_config:
frontend:
themes: !include themes.yaml
extra_html_url:
- /local/custom-icons.html
lovelace:
mode: yaml
tts:
- platform: google_translate
language: 'sv'
logger:
default: warning
logs:
braviarc.braviarc: fatal
homeassistant.components.sensor: fatal
homeassistant.components.rest.sensor: fatal
homeassistant.components.command_line.sensor: fatal
homeassistant.components.braviatv.media_player: fatal
homeassistant.components.websocket_api: fatal
homeassistant.components.input_number: fatal
homeassistant.components.template.sensor: fatal
recorder:
purge_keep_days: 7
include:
entities:
['light.belysning', 'light.taklampor', 'light.fonsterlampa', 'media_player.sony_bravia_tv', 'media_player.playstation_4', 'media_player.vardagsrum_2', 'light.datorlampa', 'switch.dator_template', 'switch.wemo_monitorer',
'light.badrum', 'light.taklampa', 'light.kladkammare_2', 'light.hall', 'light.mattias', 'light.sanja', 'switch.wemo_flakt', 'sensor.hall_temperature', 'device_tracker.mattias', 'device_tracker.sanja',
'binary_sensor.sensor_hall_motion', 'binary_sensor.sensor_badrum_motion', 'binary_sensor.sensor_kladkammare_motion', 'binary_sensor.wemo_motion', 'sensor.sensor_hall_temperature', 'sensor.tvatta_countdown',
'sensor.imac_cpu_per', 'sensor.imac_macintosh_hd', 'sensor.imac_mem_per', 'sensor.imac_system_ssd', 'sensor.imac_time_machine', 'sensor.synology_dsm_network_up', 'sensor.synology_dsm_network_down', 'sensor.printer_color', 'sensor.printer_black']
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
browser_mod:
devices:
a64202bc-052dc584:
name: imac_chrome
c1f5f9e5-9091b0b6:
name: tablet
homekit:
auto_start: false
filter:
include_entities:
['switch.wemo_flakt', 'switch.wemo_monitorer', 'switch.dator_template', 'media_player.sony_bravia_tv', 'switch.playstation_template', 'input_boolean.motion_hall', 'input_boolean.motion_garderob', 'input_boolean.motion_badrum']
entity_config:
switch.wemo_flakt:
name: Fläkt
switch.wemo_monitorer:
name: Monitorer
type: outlet
switch.dator_template:
name: Dator
media_player.sony_bravia_tv:
name: Tv
feature_list:
- feature: on_off
media_player.playstation_4:
name: Playstation
feature_list:
- feature: on_off
input_boolean:
loading_dator:
loading_tv:
loading_playstation:
appletv_notitle:
motion_hall:
motion_garderob:
motion_badrum:
motion_vardagsrum:
input_number:
monitorer_volume:
name: Volym
icon: 'mdi:volume-high'
initial: 20
min: 7
max: 50
step: 1
unit_of_measurement: "%"
fullykiosk_brightness_slider:
name: Ljusstyrka
icon: 'mdi:brightness-percent'
initial: 20
min: 0
max: 100
step: 1
unit_of_measurement: "%"
flakt_minuter:
name: Timer
icon: 'mdi:timer'
initial: 6
min: 1
max: 12
step: 1
unit_of_measurement: "h"
input_select:
hdmi:
name: Källa
options:
['HDMI 1', 'HDMI 2/MHL', 'HDMI 3', 'HDMI 4']
initial: HDMI 1
icon: mdi:video-input-hdmi
ps4_game:
name: Senast spelat
options:
- Inte igång...
icon: mdi:gamepad
switch:
- platform: switchbot
mac: !secret switchbot_mac
- platform: command_line
switches:
fullykiosk_screen:
command_on: !secret fullykiosk_screen_on
command_off: !secret fullykiosk_screen_off
command_state: !secret fullykiosk_screen_state
value_template: '{{ value == "on" }}'
friendly_name: Fullykiosk Screen
- platform: template
switches:
dator_template:
value_template: "{{ is_state('switch.imac', 'on') }}"
turn_on:
service: script.dator_on
turn_off:
service: script.dator_off
tv_template:
value_template: "{{ is_state('media_player.sony_bravia_tv', 'on') }}"
turn_on:
service: script.tv_on
turn_off:
service: script.tv_off
playstation_template:
friendly_name: Playstation
value_template: "{{ is_state('sensor.ps4_state', 'on') }}"
turn_on:
service: script.playstation_on
turn_off:
service: script.playstation_off
auto_stangallt_template:
friendly_name: Stäng allt
value_template: "{{ states('script.auto_stang_allt') }}"
turn_on:
service: script.auto_stang_allt
turn_off:
service: script.auto_stang_allt
auto_hemma_template:
friendly_name: Hemma
value_template: "{{ states('script.auto_hemma') }}"
turn_on:
service: script.auto_hemma
turn_off:
service: script.auto_hemma
- platform: wake_on_lan
mac: !secret wake_on_lan_mac_address
name: iMac
host: !secret wake_on_lan_host
shell_command:
# Setup on macos
# System Preferences > Sharing > Remote Login
# ssh [email protected]
# ssh-keygen
# /config/.ssh/id_rsa
# ssh-copy-id -i /config/.ssh/id_rsa [email protected]
imac_turn_off: !secret imac_turn_off
imac_sleep: !secret imac_sleep
imac_restart: !secret imac_restart
fullykiosk_brightness_slider: !secret fullykiosk_brightness_slider
fullykiosk_load_start_url: !secret fullykiosk_load_start_url
fullykiosk_restart_app: !secret fullykiosk_restart_app
reference_click: !secret reference_click
reference_kill: !secret reference_kill
reference_monitors: !secret reference_monitors
reference_headphones: !secret reference_headphones
ssh_motion_hall_notify: !secret ssh_motion_hall_notify
clear_logs: truncate -s 0 /config/home-assistant.log
imac_start_time_machine_backup: !secret imac_start_time_machine_backup
monitorer_volume_slider: !secret monitorer_volume_slider
monitorer_volume_up: !secret monitorer_volume_up
monitorer_volume_down: !secret monitorer_volume_down
monitorer_mute_off: !secret monitorer_mute_off
monitorer_mute_on: !secret monitorer_mute_on
group:
automation_system_reference:
name: Automatisk kalibrationsprofil
icon: 'mdi:tune-vertical'
entities:
['automation.reference_monitors', 'automation.reference_headphones']
hacs:
token: !secret hacs_token
wemo:
light:
- platform: group
name: Belysning
entities:
['light.tvlampa', 'light.golvlampa']
- platform: group
name: Taklampor
entities:
['light.spot_1', 'light.spot_2']
- platform: group
name: alla_lampor_utom_hall
entities:
['light.fonsterlampa', 'light.tvlampa', 'light.golvlampa', 'light.datorlampa', 'light.vask_hoger', 'light.vask_vanster',
'light.kladkammare_2', 'light.taklampa', 'light.mattias', 'light.sanja', 'light.spot_1', 'light.spot_2']
media_player:
- platform: braviatv
host: !secret braviatv_host
- platform: spotify
client_id: !secret spotify_client_id
client_secret: !secret spotify_client_secret
device_tracker:
- platform: iphonedetect
consider_home: 180
new_device_defaults:
track_new_devices: false
hide_if_away: false
hosts:
Mattias: !secret iphonedetect_mattias
Sanja: !secret iphonedetect_sanja
google:
client_id: !secret google_client_id
client_secret: !secret google_client_secret
binary_sensor:
- platform: ping
host: !secret ping_iphone_xr
name: iPhone XR
- platform: ping
host: secret ping_macbook_pro
name: MacBook Pro
- platform: ping
host: secret ping_iphone_x
name: iPhone X
sensor:
- platform: snmp
host: !secret synologydsm_host
community: public
name: Drifttid
baseoid: !secret synologydsm_baseoid
value_template: >
{% set uptime = value %}
{% set days = ((uptime | int) / 8640000) | int %}
{% set hours = ((uptime | int) / 360000) | int %}
{% set minutes = ((uptime | int) / 6000) | int %}
{% if days >= 2 %}{{ days }} dagar
{% elif days >= 1 %}{{ days }} dag
{% elif minutes < 1 %}Mindre än 1 minut
{% elif minutes <= 1 %}{{ minutes }} minut
{% elif minutes < 60 %}{{ minutes }} minuter
{% elif hours <= 1 %}{{ hours }} timme
{% elif hours < 24 %}{{ hours }} timmar
{% endif %}
- platform: plex_recently_added
token: !secret plex_recently_added_token
host: !secret plex_recently_added_host
port: !secret plex_recently_added_port
img_dir: '/plex/'
max: 1
- platform: command_line
name: imac_get_ip
scan_interval: 900
command: !secret imac_get_ip
- platform: command_line
name: imac_system_ssd
scan_interval: 900
unit_of_measurement: "%"
command: !secret imac_system_ssd
- platform: command_line
name: imac_macintosh_hd
scan_interval: 900
unit_of_measurement: "%"
command: !secret imac_macintosh_hd
- platform: command_line
name: imac_time_machine
scan_interval: 900
unit_of_measurement: "%"
command: !secret imac_time_machine
- platform: command_line
name: imac_cpu_per
scan_interval: 900
unit_of_measurement: "%"
command: !secret imac_cpu_per
- platform: command_line
name: imac_mem_per
scan_interval: 900
unit_of_measurement: "%"
command: !secret imac_mem_per
- platform: command_line
name: getvolume
scan_interval: 900
command: !secret monitorer_update_volume
- platform: command_line
name: monitorer_mute_check
scan_interval: 900
command: !secret monitorer_mute_check
- platform: command_line
name: printer_color
scan_interval: 21600
command: !secret printer_color
- platform: command_line
name: printer_black
scan_interval: 21600
command: !secret printer_black
- platform: command_line
name: printer_status
scan_interval: 10
command: !secret printer_status
- platform: command_line
name: macos_uptime
scan_interval: 120
command: !secret macos_uptime
- platform: version
name: hass_version_installed
- platform: version
name: hass_version_latest
beta: false
image: raspberrypi3
source: hassio
- platform: filesize
file_paths:
- /config/home-assistant_v2.db
- platform: filesize
file_paths:
- /config/home-assistant.log
- platform: rest
name: fullykiosk
json_attributes:
['batteryLevel', 'screenBrightness', 'motionDetectorState', 'plugged', 'deviceName', 'deviceModel', 'lastAppStart', 'internalStorageFreeSpace', 'internalStorageTotalSpace', 'ramFreeMemory', 'ramTotalMemory']
resource: !secret fullykiosk_rest_resource
value_template: '{{ value_json.isScreenOn }}'
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_use_percent
- type: processor_use
- type: last_boot
- platform: dnsip
- platform: synologydsm
host: !secret synologydsm_host
port: !secret synologydsm_port
ssl: false
username: !secret synologydsm_username
password: !secret synologydsm_password
monitored_conditions:
['cpu_total_load', 'memory_real_usage', 'volume_status', 'volume_percentage_used', 'network_up', 'network_down', 'disk_temp']
- platform: rpi_power
text_state: true
- platform: time_date
display_options:
['time', 'date']
- platform: darksky
api_key: !secret darksky_api_key
language: sv
monitored_conditions:
['precip_probability', 'temperature', 'apparent_temperature', 'icon']
- platform: template
sensors:
fullykiosk_device_name:
friendly_name: Modell
icon_template: 'mdi:tablet'
value_template: "{{ state_attr('sensor.fullykiosk', 'deviceName') }} ({{ state_attr('sensor.fullykiosk', 'deviceModel') }})"
flakt_timer_value:
friendly_name: Stäng av fläkt efter timer
icon_template: 'mdi:fan-off'
unit_of_measurement: h
value_template: "{{ states('input_number.flakt_minuter') | int }}"
fullykiosk_battery_level:
friendly_name: Batteri
unit_of_measurement: '%'
value_template: "{{ state_attr('sensor.fullykiosk', 'batteryLevel') }}"
icon_template: >-
{% set battery_level = state_attr('sensor.fullykiosk', 'batteryLevel')|int('unknown') %}
{% set battery_round = (battery_level|int / 10)|int * 10 %}
{% if battery_level == 'unknown' %}
mdi:battery-unknown
{% else %}
{% if battery_round >= 100 %}
mdi:battery
{% elif battery_round > 0 %}
mdi:battery-{{ battery_round }}
{% else %}
mdi:battery-alert
{% endif %}
{% endif %}
fullykiosk_plugged:
friendly_name: Strömsladd ansluten
value_template: >-
{% if state_attr('sensor.fullykiosk', 'plugged') == true %} Ja {% else %} Nej {% endif %}
icon_template: >-
{% if state_attr('sensor.fullykiosk', 'plugged') == true %} mdi:power-plug {% else %} mdi:power-plug-off {% endif %}
fullykiosk_motion_detector_state:
friendly_name: Rörelsedetektor
icon_template: 'mdi:camera-front-variant'
value_template: >-
{% if state_attr('sensor.fullykiosk', 'motionDetectorState') == 0 %}
Inte igång
{% else %}
På
{% endif %}
fullykiosk_storage_percentage:
friendly_name: Lagring
icon_template: 'mdi:sd'
unit_of_measurement: '%'
value_template: "{{ 100 - ( state_attr('sensor.fullykiosk', 'internalStorageFreeSpace') / state_attr('sensor.fullykiosk', 'internalStorageTotalSpace') * 100 ) | int }}"
fullykiosk_memory_percentage:
friendly_name: Minne
icon_template: 'mdi:memory'
unit_of_measurement: '%'
value_template: "{{ 100 - ( state_attr('sensor.fullykiosk', 'ramFreeMemory') / state_attr('sensor.fullykiosk', 'ramTotalMemory') * 100 ) | int }}"
macos_uptime_template:
entity_id: sensor.time
friendly_name: Drifttid
icon_template: 'mdi:clock'
value_template: >
{% set uptime = (as_timestamp(now()) - as_timestamp(states('sensor.macos_uptime') | int | timestamp_local | default(0))) %}
{% if uptime | timestamp_custom("%d") | int-1 == 1 %}{{ uptime | timestamp_custom("%d") | int-1}} dag
{% elif uptime | timestamp_custom("%d") | int-1 >= 2 %}{{ uptime | timestamp_custom("%d") | int-1}} dagar
{% elif uptime | timestamp_custom("%H") | int-1 == 1 %}{{ uptime | timestamp_custom("%H") | int-1}} timme
{% elif uptime | timestamp_custom("%H") | int-1 >= 2 %}{{ uptime | timestamp_custom("%H") | int-1}} timmar
{% elif uptime | timestamp_custom("%M") | int == 1 %}{{ uptime | timestamp_custom("%M") | int}} minut
{% elif uptime | timestamp_custom("%M") | int >= 2 %}{{ uptime | timestamp_custom("%M") | int}} minuter
{% else %}Minde än 1 minut
{% endif %}
fullykiosk_last_app_start:
entity_id: sensor.time
friendly_name: Senaste omstart av app
icon_template: 'mdi:restart'
value_template: >
{% set lastAppStart = (as_timestamp(now()) - as_timestamp(state_attr('sensor.fullykiosk', 'lastAppStart') | default(0))) %}
{% if lastAppStart | timestamp_custom("%d") | int-1 == 1 %}{{ lastAppStart | timestamp_custom("%d") | int-1}} dag sedan
{% elif lastAppStart | timestamp_custom("%d") | int-1 >= 2 %}{{ lastAppStart | timestamp_custom("%d") | int-1}} dagar sedan
{% elif lastAppStart | timestamp_custom("%H") | int-1 == 1 %}{{ lastAppStart | timestamp_custom("%H") | int-1}} timme sedan
{% elif lastAppStart | timestamp_custom("%H") | int-1 >= 2 %}{{ lastAppStart | timestamp_custom("%H") | int-1}} timmar sedan
{% elif lastAppStart | timestamp_custom("%M")|int == 1 %}{{ lastAppStart | timestamp_custom("%M") | int}} minut sedan
{% elif lastAppStart | timestamp_custom("%M")|int >= 2 %}{{ lastAppStart | timestamp_custom("%M") | int}} minuter sedan
{% else %}Minde än 1 minut sedan
{% endif %}
dag:
entity_id: sensor.date
value_template: >
{% set days = ["Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"] %}
{{ days[now().weekday()] }}
datum:
value_template: >
{% set months = ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"] %}
{{ strptime(states('sensor.date'), '%Y-%m-%d').day }}
{{ months[now().month-1] }}
hall_temperature:
unit_of_measurement: "°C"
friendly_name: Temperatur Hall
value_template: "{{ (states('sensor.sensor_hall_temperature')|float)|round(1) }}"
runda_darksky_prob:
value_template: >
{{ states('sensor.dark_sky_precip_probability') | round }}%
runda_darksky_temp:
value_template: >
{{ states('sensor.dark_sky_apparent_temperature') | round }}°
hass_version_template:
value_template: >-
{% if states('sensor.hass_version_installed') == states('sensor.hass_version_latest') %}
Ja
{% else %}
Nej - {{ states('sensor.hass_version_latest') }}
{% endif %}
vpn_imac:
value_template: >-
{% if states('sensor.imac_get_ip') == states('sensor.myip') %}
Ej Ansluten
{% else %}
Ansluten
{% endif %}
icon_template: >-
{% if states('sensor.imac_get_ip') == states('sensor.myip') %}
mdi:shield-alert
{% else %}
mdi:shield-check
{% endif %}
rpi_power_template:
friendly_name: Strömförsörjning
icon_template: 'mdi:raspberry-pi'
value_template: >-
{% if states('sensor.rpi_power_status') == 'Everything is working as intended' %}
Fungerar bra
{% else %}
{{ states('sensor.rpi_power_status') }}
{% endif %}
mattias_battery_level:
friendly_name: Batteri
unit_of_measurement: '%'
value_template: "{{ states('sensor.battery_level') }}"
icon_template: >-
{% set battery_level = states('sensor.battery_level')|int('unknown') %}
{% set battery_round = (battery_level|int / 10)|int * 10 %}
{% if battery_level == 'unknown' %}
mdi:battery-unknown
{% else %}
{% if battery_round >= 100 %}
mdi:battery
{% elif battery_round > 0 %}
mdi:battery-{{ battery_round }}
{% else %}
mdi:battery-alert
{% endif %}
{% endif %}
printer_status_template:
friendly_name: Skrivare
icon_template: 'mdi:printer'
value_template: >-
{% if is_state("sensor.printer_status", "ready") %}
På
{% elif is_state("sensor.printer_status", "inPowerSave") %}
Viloläge
{% elif is_state("sensor.printer_status", "processing") %}
Skriver ut
{% elif is_state("sensor.printer_status", "") %}
Av
{% else %}
{{ states('sensor.printer_status') }}
{% endif %}
synology_dsm_status:
friendly_name: Systemhälsa
icon_template: 'mdi:nas'
value_template: >-
{% if is_state("sensor.synology_dsm_status_volume_1", "normal") %}
Bra
{% else %}
{{ states('sensor.synology_dsm_status_volume_1') }}
{% endif %}
tvatta_countdown:
entity_id: sensor.time
friendly_name: Tvätta
value_template: >-
{% set calendar_tvattid = state_attr('calendar.tvatta', 'start_time') %}
{% set nu_tid = now() %}
{% set dag = strptime(calendar_tvattid, "%Y-%m-%d %H:%M:%S").strftime("%A") | replace('Monday', 'Måndag') | replace('Tuesday', 'Tisdag') | replace('Wednesday', 'Onsdag') | replace('Thursday', 'Torsdag') | replace('Friday', 'Fredag') | replace('Saturday', 'Lördag') | replace('Sunday', 'Söndag') %}
{% set tid = as_timestamp(calendar_tvattid) | timestamp_custom('%H:%M') %}
{% set sub_timmar = as_timestamp(calendar_tvattid) | timestamp_custom('%H') | int / 24 %}
{% set count = (as_timestamp(calendar_tvattid) - as_timestamp(nu_tid)) / 86400 - sub_timmar %}
{% if count <= -1.0 %}
Sätt ny tvättid...
{% elif count <= 0.0 %}
{{'\U0001F4A6'}} Tvätt idag klockan {{ tid }}
{% elif count <= 1.0 %}
Tvätt imorgon klockan {{ tid }}
{% elif count <= 2.0 %}
Tvätt i övermorgon klockan {{ tid }}
{% else %}
Tvätt om {{ (count + sub_timmar) | round }} dagar på {{ dag }} kl {{ tid }}
{% endif %}
mattias_last_changed:
entity_id: sensor.time
value_template: >-
{%- set time = (as_timestamp(now()) - as_timestamp(states.device_tracker.mattias.last_changed)) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set days = (time // 86400) %}
{% if time <= 60 %}
{# mindre eller = 59 sekunder #}
0m
{% elif time <= 3600 %}
{# mindre eller = 59 minuter #}
{{ minutes }}m
{% elif time <= 86400 %}
{# mindre eller = 23h och 59 minuter #}
{{ hours }}h
{% elif time > 86400 %}
{# mer eller = 1 dag #}
{{ days }}d
{% else %}
{% endif %}
sanja_last_changed:
entity_id: sensor.time
value_template: >-
{%- set time = (as_timestamp(now()) - as_timestamp(states.device_tracker.sanja.last_changed)) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set days = (time // 86400) %}
{% if time <= 60 %}
{# mindre eller = 60 sekunder #}
0m
{% elif time <= 3600 %}
{# mindre eller = 60 minuter #}
{{ minutes }}m
{% elif time <= 86400 %}
{# mindre eller = 24h #}
{{ hours }}h
{% elif time > 86400 %}
{# mer eller = 1 dag #}
{{ days }}d
{% else %}
{% endif %}
mattias_last_changed_h:
entity_id: sensor.time
value_template: >-
{%- set time = (as_timestamp(now()) - as_timestamp(states.device_tracker.mattias.last_changed)) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set days = (time // 86400) %}
{% if time <= 60 %}
{# mindre eller = 59 sekunder #}
mindre än 1m
{% elif time <= 3600 %}
{# mindre eller = 59 minuter #}
{{ minutes }}m
{% elif time <= 86400 and minutes == 0 %}
{# spec #}
{{ hours }}h
{% elif time <= 86400 %}
{# mindre eller = 23h och 59 minuter #}
{{ hours }}h och {{ minutes }}m
{% elif time > 86400 %}
{# mer eller = 1 dag #}
{{ days }}d
{% else %}
{% endif %}
sanja_last_changed_h:
entity_id: sensor.time
value_template: >-
{%- set time = (as_timestamp(now()) - as_timestamp(states.device_tracker.sanja.last_changed)) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set days = (time // 86400) %}
{% if time <= 60 %}
{# mindre eller = 59 sekunder #}
mindre än 1m
{% elif time <= 3600 %}
{# mindre eller = 59 minuter #}
{{ minutes }}m
{% elif time <= 86400 and minutes == 0 %}
{# spec #}
{{ hours }}h
{% elif time <= 86400 %}
{# mindre eller = 23h och 59 minuter #}
{{ hours }}h och {{ minutes }}m
{% elif time > 86400 %}
{# mer eller = 1 dag #}
{{ days }}d
{% else %}
{% endif %}
belysning_percent:
value_template: >-
{% if is_state('light.belysning', 'on') %} {{ (state_attr('light.belysning', 'brightness') / 2.54) | round }}{% endif %}
taklampor_percent:
value_template: >-
{% if is_state('light.taklampor', 'on') %} {{ (state_attr('light.taklampor', 'brightness') / 2.54) | round }}{% endif %}
fonsterlampa_percent:
value_template: >-
{% if is_state('light.fonsterlampa', 'on') %} {{ (state_attr('light.fonsterlampa', 'brightness') / 2.54) | round }}{% endif %}
datorlampa_percent:
value_template: >-
{% if is_state('light.datorlampa', 'on') %} {{ (state_attr('light.datorlampa', 'brightness') / 2.54) | round }}{% endif %}
mattias_percent:
value_template: >-
{% if is_state('light.mattias', 'on') %} {{ (state_attr('light.mattias', 'brightness') / 2.54) | round }}{% endif %}
sanja_percent:
value_template: >-
{% if is_state('light.sanja', 'on') %} {{ (state_attr('light.sanja', 'brightness') / 2.54) | round }}{% endif %}
badrum_percent:
value_template: >-
{% if is_state('light.badrum', 'on') %} {{ (state_attr('light.badrum', 'brightness') / 2.54) | round }}{% endif %}
kok_percent:
value_template: >-
{% if is_state('light.kok', 'on') %} {{ (state_attr('light.kok', 'brightness') / 2.54) | round }}{% endif %}
garderob_percent:
value_template: >-
{% if is_state('light.kladkammare_2', 'on') %} {{ (state_attr('light.kladkammare_2', 'brightness') / 2.54) | round }}{% endif %}
hall_percent:
value_template: >-
{% if is_state('light.hall', 'on') %} {{ (state_attr('light.hall', 'brightness') / 2.54) | round }}{% endif %}
placeholder:
value_template: " "
plex_title:
value_template: |
{% set data = state_attr('sensor.plex_recently_added', 'data') %}
{% if data | regex_findall_index('(?:"aired": ")(.*?)(?:,)') == '"' %}
{{ data | regex_findall_index('(?:"title": ")(.*?)(?:")') }} {{ data | regex_findall_index('(?:"number": ")(.*?)(?:")') }}
{% else %}
{{ data | regex_findall_index('(?:"title": ")(.*?)(?:")') }} ({{ data | regex_findall_index('(?:"aired": ")(.*?)(?:-)') }})
{% endif %}
darksky_emoji:
value_template: >-
{% if is_state("sensor.dark_sky_icon","clear-day") %} {{ '\u2600\uFE0F' }}
{% elif is_state("sensor.dark_sky_icon","clear-night") %} {{ '\U0001F319' }}
{% elif is_state("sensor.dark_sky_icon","rain") %} {{ '\U0001F327' }}
{% elif is_state("sensor.dark_sky_icon","snow") %} {{ '\U0001F328' }}
{% elif is_state("sensor.dark_sky_icon","fog") %} {{ '\u2601\uFE0F' }}
{% elif is_state("sensor.dark_sky_icon","sleet") %} {{ '\U0001F328' }}
{% elif is_state("sensor.dark_sky_icon","wind") %} {{ '\U0001F32C' }}
{% elif is_state("sensor.dark_sky_icon","cloudy") %} {{ '\u2601\uFE0F' }}
{% elif is_state("sensor.dark_sky_icon","partly-cloudy-day") %} {{ '\u26C5\uFE0F' }}
{% elif is_state("sensor.dark_sky_icon","partly-cloudy-night") %} {{ '\u2601\uFE0F' }}
{% elif is_state("sensor.dark_sky_icon","hail") %} {{ '\U0001F328' }}
{% elif is_state("sensor.dark_sky_icon","lightning") %} {{ '\U0001F329' }}
{% elif is_state("sensor.dark_sky_icon","thunderstorm") %} {{ '\u26C8' }}
{% elif is_state("sensor.dark_sky_icon","tornado") %} {{ '\U0001F32A' }}
{% endif %}
last_motion_sensor_triggered:
value_template: >-
{% set sensors = [states.input_boolean.motion_hall, states.input_boolean.motion_badrum, states.input_boolean.motion_garderob, states.input_boolean.motion_vardagsrum] %}
{% for sensor in sensors %}
{% if as_timestamp(sensor.last_changed) == as_timestamp(sensors | map(attribute='last_changed') | max) %}
{{ sensor.entity_id }}
{% endif %}
{% endfor %}
appletv_title_truncate:
value_template: >
{{ state_attr('media_player.vardagsrum_2', 'media_title') | truncate (32,true) }}
plex_title_truncate:
value_template: >
{{ states('sensor.plex_title') | truncate (32,true) }}
ps4_state:
value_template: >-
{% if is_state('media_player.playstation_4', 'off') or is_state('media_player.playstation_4', 'standby') or is_state('media_player.playstation_4', 'unknown') %}
off
{% else %}
on
{% endif %}