-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.yaml
1003 lines (965 loc) · 33.8 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
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Configure a default setup, default_config includes these items - https://www.home-assistant.io/integrations/default_config
default_config:
automation: !include automations.yaml
cloud:
alexa:
filter:
include_domains:
- climate
- light
- switch
exclude_entities:
- light.bedroom_left
- light.bedroom_right
- light.hallway_center
- light.hallway_door
- light.hallway_kitchen
- switch.hallway_switch
- switch.kitchen_sink
- switch.night_mode
- switch.office
- switch.office_desk
- switch.toggle_pi_hole
google_actions:
filter:
include_domains:
- climate
- light
- switch
exclude_entities:
- light.bedroom_left
- light.bedroom_right
- light.hallway_center
- light.hallway_door
- light.hallway_kitchen
- switch.hallway_switch
- switch.kitchen_sink
- switch.night_mode
- switch.office
- switch.office_desk
- switch.toggle_pi_hole
#config:
#frontend:
#history:
##logbook:
##map:
#mobile_app:
##person:
script: !include scripts.yaml
#ssdp:
#sun:
#system_health:
#updater:
zeroconf:
##zone:
logger:
default: info
camera:
- platform: generic
name: jet_stream
content_type: image/gif
still_image_url: https://s.w-x.co/staticmaps/wu/wu/jetstream1200_cur/conus/animate.png
- platform: generic
name: YTZ
still_image_url: http://www.metcam.navcanada.ca/dawc_images/wxcam/CYTZ/CYTZ_N-full-e.jpeg
- platform: generic
name: YYZ
still_image_url: https://511on.ca/map/Cctv/loc33--2
downloader:
download_dir: /tmp
ffmpeg:
group: !include groups.yaml
homeassistant:
auth_providers:
- type: legacy_api_password
api_password: !secret api_password
- type: trusted_networks
trusted_networks: !secret local_lan
allow_bypass_login: true
- type: homeassistant
customize: !include customize.yaml
homekit:
- filter:
include_domains:
- climate
- light
- switch
exclude_entities:
- switch.hallway_switch
- switch.kitchen_sink
- switch.night_mode
- switch.office
- switch.office_desk
- switch.toggle_pi_hole
http:
cors_allowed_origins:
- https://www.home.mustakim.com
- https://mustakim.orgfree.com
- https://alim.is
- https://alim.ml
- https://macdock.home.mustakim.com
- http://macdock.home.mustakim.com
- https://localhost
- http://localhost
- https://amhome.herokuapp.com
- http://amhome.herokuapp.com
ssl_certificate: /opt/filer/os/acme/*.home.mustakim.com/fullchain.cer
ssl_key: /opt/filer/os/acme/*.home.mustakim.com/*.home.mustakim.com.key
light:
- platform: switch
name: kitchen
entity_id: switch.kitchen_sink
- platform: switch
name: office_desk
entity_id: switch.office_desk
#media_player:
# - platform: androidtv
# name: nvidia_oshield
# host: !secret oshield_ip
# adbkey: "/config/adb/adbkey"
# - platform: androidtv
# name: nvidia_nshield
# host: !secret nshield_ip
# adbkey: "/config/adb/adbkey"
notify:
- name: alimustakim
platform: twitter
consumer_key: !secret alimustakim_consumer_key
consumer_secret: !secret alimustakim_consumer_secret_key
access_token: !secret alimustakim_access_token_key
access_token_secret: !secret alimustakim_access_token_secret_key
- name: forwardcomputers
platform: twitter
consumer_key: !secret forwardcomputers_consumer_key
consumer_secret: !secret forwardcomputers_consumer_secret_key
access_token: !secret forwardcomputers_access_token_key
access_token_secret: !secret forwardcomputers_access_token_secret_key
panel_iframe:
configurator:
title: Configurator
icon: mdi:wrench
url: !secret hass_config_url
# adguard:
# title: Adguard
# icon: mdi:shield-check
# url: !secret adguard_url
# cockpit:
# title: Cockpit
# icon: mdi:tablet-dashboard
# url: !secret cockpit_url
# webcode:
# title: Webcode
# icon: mdi:microsoft-visual-studio-code
# url: !secret webcode_url
# deconz:
# title: deCONZ
# icon: mdi:zigbee
# url: !secret deconz_url
# zigbee2mqtt:
# title: zigbee
# icon: mdi:zigbee
# url: !secret zigbee2mqtt_url
# netdata:
# title: Netdata
# icon: mdi:counter
# url: !secret docker_netdata_url
plant:
Coleus:
sensors:
battery: sensor.kitchen_battery
brightness: sensor.kitchen_light_intensity
conductivity: sensor.kitchen_conductivity
moisture: sensor.kitchen_moisture
temperature: sensor.kitchen_temperature
check_days: 3
min_battery: 15
min_brightness: 3000
max_brightness: 70000
min_conductivity: 350
max_conductivity: 2000
min_moisture: 15
max_moisture: 60
min_temperature: 10
max_temperature: 35
python_script:
recorder:
exclude:
domains:
- automation
- binary_sensor
- camera
- device_tracker
- light
- media_player
- person
- plant
- remote
- script
- sensors
- sun
- switch
- weather
- zone
include:
domains:
- climate
entities:
- sensor.temperature
- sensor.feels_like
- sensor.temperature_in
- sensor.humidity
- sensor.humidity_in
- sensor.speedtest_download
- sensor.speedtest_ping
- sensor.speedtest_upload
purge_keep_days: 30
rest_command:
clean_printer:
method: post
payload: "CleaningMode=Start"
url: !secret printer_cleaning_url
pi_hole_disable:
method: get
url: !secret pi_hole_disable_url
pi_hole_enable:
method: get
url: !secret pi_hole_enable_url
shell_command:
macbook_sleep: !secret macbook_sleep_cmd
spotify:
client_id: !secret spotify_client_id
client_secret: !secret spotify_client_secret
sensor:
- platform: rest
name: aqhi
resource: https://dd.weather.gc.ca/air_quality/aqhi/ont/observation/realtime/xml/AQ_OBS_FEUZB_CURRENT.xml
scan_interval: 3600
json_attributes_path: '$.*'
value_template: '{{ value_json.conditionAirQuality.airQualityHealthIndex | round(0) }}'
- platform: scrape
name: pollen
resource: https://www.theweathernetwork.com/ca/forecasts/pollen/ontario/toronto
select: "#allergy_conditions > div.allergy-summary > div.summary-item.pollen > div.allergy-level"
scan_interval: 3600
- platform: scrape
name: mold
resource: https://www.theweathernetwork.com/ca/forecasts/pollen/ontario/toronto
select: "#allergy_conditions > div.allergy-summary > div.summary-item.mold > div.allergy-level"
scan_interval: 3600
- platform: command_line
name: flu
command: "/usr/bin/wget -O - \"https://www.theweathernetwork.com/ca/health/ontario/toronto\" 2>&1 | awk -F '[ \"]' '/activity-colour/ {gsub(/_/,\" \",$4); print toupper( substr( $4, 1, 1 ) ) substr( $4, 2 )}'"
scan_interval: 3600
- platform: command_line
name: ec_current_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//currentConditions/condition/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_current_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//currentConditions/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_1_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[1]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_1_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[1]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_1_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[1]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_2_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[2]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_2_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[2]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_2_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[2]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_3_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[3]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_3_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[3]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_3_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[3]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_4_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[4]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_4_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[4]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_4_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[4]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_5_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[5]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_5_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[5]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_5_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[5]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: command_line
name: ec_6_name
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[6]/period/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_6_icon
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[6]/abbreviatedForecast/iconCode/text()'); print(*rev)" || true
scan_interval: 1800
- platform: command_line
name: ec_6_summary_text
command: python3 -c "import lxml.etree; doc=lxml.etree.parse('/tmp/toronto.xml'); rev=doc.xpath('//forecastGroup/forecast[6]/textSummary/text()')[0]; print(rev[:250])" || true
scan_interval: 1800
- platform: systemmonitor
scan_interval: 5
resources:
- type: disk_use_percent
arg: "/"
- type: memory_use_percent
- type: processor_use
- type: swap_use_percent
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://127.0.0.1:19999/api/v1/info').json()['host_labels']['_os_name'])" || true
name: OS
scan_interval: 86400
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://127.0.0.1:19999/api/v1/info').json()['host_labels']['_os_version'])" || true
name: Version
scan_interval: 86400
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://127.0.0.1:19999/api/v1/info').json()['host_labels']['_kernel_version'])" || true
name: Kernel Version
scan_interval: 86400
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://127.0.0.1:2375/info').json()['ServerVersion'])" || true
name: Docker Version
scan_interval: 86400
- platform: command_line
command: python3 -c "import requests; print(requests.get('http://127.0.0.1:2375/info').json()['ContainersRunning'])" || true
name: Docker Containers
scan_interval: 86400
- platform: command_line
name: sys_family
command: awk '{ printf "%s ", $1 }' /sys/class/dmi/id/product_family
scan_interval: 86400
- platform: command_line
name: sys_name
command: awk '{ printf "%s ", $1 }' /sys/class/dmi/id/product_name
scan_interval: 86400
- platform: command_line
name: sys_current_firmware
command: awk -F. '{print $3}' < /sys/class/dmi/id/bios_version
scan_interval: 86400
- platform: command_line
name: sys_latest_firmware
command: python3 /config/scripts/NUC7i3DNKE_firmware || true
scan_interval: 86400
- platform: rest
scan_interval: 3600
name: docker_github_version
resource: https://api.github.com/repos/docker/docker-ce/releases/latest
username: !secret github_user
password: !secret github_token
authentication: basic
value_template: '{{ value_json.name }}'
headers:
Accept: application/vnd.github.v3+json
Content-Type: application/json
User-Agent: Home Assistant REST sensor
- platform: netdata
host: !secret server_ip
scan_interval: 30
resources:
server_uptime_raw:
data_group: "system.uptime"
element: "uptime"
server_system_processes_raw:
data_group: "system.active_processes"
element: "active"
server_cpu_temp:
data_group: "sensors.coretemp-isa-0000_temperature"
element: "coretemp-isa-0000_temp1"
icon: mdi:thermometer
- platform: template
sensors:
server_system_processes:
value_template: >-
{{- int(0) + states('sensor.netdata_server_system_processes_raw') | int(0) -}}
server_uptime:
value_template: >-
{% set uptime = float(0) + states('sensor.netdata_server_uptime_raw') | float(0) %}
{% set updays = (uptime / 86400) | round(0, "floor") %}
{% set uphours = uptime | timestamp_custom('%-H:%-M:%-S', false) | regex_replace('^0:','') %}
{% if updays == 0 %}
{{- uphours -}}
{% elif updays == 1 %}
{{- updays ~ " Day, " ~ uphours -}}
{% else %}
{{- updays ~ " Days, " ~ uphours -}}
{% endif %}
- platform: netdata
host: !secret firewall_ip
scan_interval: 30
resources:
firewall_uptime_raw:
data_group: "system.uptime"
element: "uptime"
firewall_cpu_temp_raw:
data_group: "sensors.temp_thermal_zone2_thermal_thermal_zone2"
element: "sys_devices_virtual_thermal_thermal_zone2_temp"
firewall_mem_free:
data_group: "system.ram"
element: "free"
- platform: command_line
name: firewall_latest_firmware
command: python3 -c "import lxml.html; import requests; html=requests.get('https://downloads.openwrt.org'); doc=lxml.html.fromstring(html.text); rev=doc.xpath('/html/body/div/ul[1]/li/strong/a/text()')[0]; print(rev.split()[-1])" || true
scan_interval: 86400
- platform: command_line
name: firewall_release
command: !secret firewall_release
scan_interval: 86400
- platform: command_line
name: firewall_mem_available
command: !secret firewall_mem_available
scan_interval: 86400
- platform: command_line
name: firewall_cpu_load
command: !secret firewall_cpu_load
unit_of_measurement: '%'
scan_interval: 30
- platform: template
sensors:
firewall_cpu_temp:
value_template: >-
{{- states('sensor.netdata_firewall_cpu_temp_raw') | round(0, "floor") -}}
unit_of_measurement: '°C'
firewall_model:
value_template: "QOTOM Q330G4"
firewall_uptime:
value_template: >-
{% set uptime = states('sensor.netdata_firewall_uptime_raw') | float(0) + states('sensor.netdata_firewall_uptime_raw') | float(0) %}
{% set updays = (uptime / 86400) | round(0, "floor") %}
{% set uphours = uptime | timestamp_custom('%-H:%-M:%-S', false) | regex_replace('^0:','') %}
{% if updays == 0 %}
{{- uphours -}}
{% elif updays == 1 %}
{{- updays ~ " Day, " ~ uphours -}}
{% else %}
{{- updays ~ " Days, " ~ uphours -}}
{% endif %}
firewall_mem_used:
unit_of_measurement: '%'
value_template: >-
{% set m = states('sensor.firewall_mem_available') | float(0) + states('sensor.firewall_mem_available') | float(0) %}
{% set n = states('sensor.netdatat_firewall_mem_free') | float(0) + states('sensor.netdatat_firewall_mem_free') | float(0) %}
{% if m == 'unknown' %} {% set m = 0 %} {% endif %}
{% if n == 'unknown' %} {% set n = 0 %} {% endif %}
{% if m != 0 -%}
{{ ((n / m) * 100) | round(0, "ceil") }}
{% else %}
{{ 0 }}
{% endif %}
- platform: uptime
name: uptime_minutes
scan_interval: 30
# {% set uptime = states('sensor.uptime_minutes') | float * 60 | float(0) %}
- platform: template
sensors:
hass_uptime:
value_template: >-
{% set uptime = states('sensor.uptime_minutes') | float(0) + (states('sensor.uptime_minutes') * 60 ) | float(0) %}
{% set updays = (uptime / 86400) | round(0, "floor") %}
{% set uphours = uptime | timestamp_custom('%-H:%-M:%-S', false) | regex_replace('^0:','') %}
{% if updays == 0 %}
{{- uphours -}}
{% elif updays == 1 %}
{{- updays ~ " Day, " ~ uphours -}}
{% else %}
{{- updays ~ " Days, " ~ uphours -}}
{% endif %}
- platform: rest
scan_interval: 3600
name: hass_github_version
resource: https://api.github.com/repos/home-assistant/home-assistant/releases/latest
username: !secret github_user
password: !secret github_token
authentication: basic
value_template: '{{ value_json.name }}'
headers:
Accept: application/vnd.github.v3+json
Content-Type: application/json
User-Agent: Home Assistant REST sensor
- platform: command_line
name: printer_latest_firmware
command: python3 -c "import ftplib,re;ftp=ftplib.FTP('ftp.hp.com');ftp.login();ftp.cwd('/pub/networking/software/pfirmware');ftpd=ftp.nlst();pattern='HP_LaserJet_Pro_M130a_M132a_and_Ultra_M134a_Printer_Firmware_(\d+).rfu';r=re.compile(pattern);fname=list(filter(r.match,ftpd));print(re.search(pattern,fname[-1]).group(1))"
scan_interval: 86400
- platform: command_line
name: printer_sn
command: !secret printer_sn
scan_interval: 86400
- platform: command_line
name: printer_fw
command: !secret printer_fw
scan_interval: 3600
- platform: template
sensors:
printer_model:
value_template: 'HP MFP M130fw'
- platform: snmp
name: printer_toner
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.6.1.1
accept_errors: true
default_value: ''
scan_interval: 86400
- platform: snmp
name: printer_toner_now
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.9.1.1
accept_errors: true
default_value: '0'
scan_interval: 1800
- platform: snmp
name: printer_toner_max
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.8.1.1
accept_errors: true
default_value: '0'
scan_interval: 86400
- platform: template
sensors:
printer_toner_pct:
unit_of_measurement: '%'
value_template: >-
{% set m = float(0) + states('sensor.printer_toner_max') | float(0) %}
{% set n = float(0) + states('sensor.printer_toner_now') | float(0) %}
{% if m != 0 -%}
{{ ((n / m) * 100) | round(0) }}
{% else %}
{{ 0 }}
{% endif %}
# {% if m == 'unknown' %} {% set m = 0 %} {% endif %}
# {% if n == 'unknown' %} {% set n = 0 %} {% endif %}
- platform: snmp
name: printer_drum
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.6.1.5
accept_errors: true
default_value: ''
scan_interval: 86400
- platform: snmp
name: printer_drum_now
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.9.1.5
accept_errors: true
default_value: '0'
scan_interval: 1800
- platform: snmp
name: printer_drum_max
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.11.1.1.8.1.5
accept_errors: true
default_value: '0'
scan_interval: 86400
- platform: template
sensors:
printer_drum_pct:
unit_of_measurement: '%'
value_template: >-
{% set m = float(0) + states('sensor.printer_drum_max') | float(0) %}
{% set n = float(0) + states('sensor.printer_drum_now') | float(0) %}
{% if m != 0 -%}
{{ ((n / m) * 100) | round(0) }}
{% else %}
{{ 0 }}
{% endif %}
# {% if m == 'unknown' %} {% set m = 0 %} {% endif %}
# {% if n == 'unknown' %} {% set n = 0 %} {% endif %}
- platform: snmp
name: printer_pages
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.43.10.2.1.4.1.1
accept_errors: true
default_value: '0'
scan_interval: 1800
- platform: snmp
name: printer_uptime
host: !secret laser_ip
baseoid: 1.3.6.1.2.1.1.3.0
accept_errors: true
default_value: '0'
scan_interval: 30
value_template: >-
{% set uptime = float(value) / 100 %}
{% set updays = (uptime / 86400) | round(0, "floor") %}
{% set uphours = uptime | timestamp_custom('%-H:%-M:%-S', false) | regex_replace('^0:','') %}
{% if updays == 0 %}
{{- uphours -}}
{% elif updays == 1 %}
{{- updays ~ " Day, " ~ uphours -}}
{% else %}
{{- updays ~ " Days, " ~ uphours -}}
{% endif %}
- platform: template
sensors:
temperature_in:
friendly_name: Inside temperature
unit_of_measurement: '°C'
value_template: "{{ state_attr('climate.thermostat', 'current_temperature') }}"
humidity_in:
friendly_name: Inside humidity
unit_of_measurement: '%'
value_template: "{{ state_attr('climate.thermostat', 'current_humidity') }}"
feels_like:
friendly_name: Feels like
unit_of_measurement: '°C'
value_template: >-
{% if not is_state('sensor.wind_chill', 'unknown') %}
{{ states('sensor.wind_chill') }}
{% elif not is_state('sensor.humidex', 'unknown') %}
{{ states('sensor.humidex') }}
{% else %}
{{ states('sensor.temperature') }}
{% endif %}
- platform: template
sensors:
sun_next_rising:
value_template: "{{ as_timestamp(state_attr('sun.sun', 'next_rising')) | timestamp_custom(' %-I:%M %p') }}"
sun_next_setting:
value_template: "{{ as_timestamp(state_attr('sun.sun', 'next_setting')) | timestamp_custom(' %-I:%M %p') }}"
- platform: time_date
display_options:
- 'time'
- 'time_utc'
- platform: worldclock
name: UK
time_zone: Europe/London
- platform: worldclock
name: San Francisco
time_zone: America/Los_Angeles
# - platform: nut
# name: Office UPS
# username: ups
# host: !secret synology_ip
# resources:
# - ups.status.display
# - ups.load
# - battery.runtime
# - battery.charge
# - ups.status
- platform: template
sensors:
office_ups_battery_runtime_mins:
unit_of_measurement: 'min'
value_template: "{{ float(states('sensor.office_ups_battery_runtime')) / 60 | round(2)}}"
office_ups_model:
value_template: "Back-UPS BX1500G"
office_ups_serial_number:
value_template: "3B1106X32967"
- platform: template
sensors:
office_ups_status_data_short:
value_template: "{{ states('sensor.office_ups_status_data').split(' ')[0] }}"
- platform: snmp
name: nas_status
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.1.0
accept_errors: true
default_value: '0'
scan_interval: 30
- platform: snmp
name: nas_cpu_temp
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.2.0
accept_errors: true
unit_of_measurement: '°C'
default_value: '0'
scan_interval: 30
- platform: snmp
name: nas_sys_fan_status
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.4.1.0
accept_errors: true
default_value: '0'
scan_interval: 30
- platform: snmp
name: nas_cpu_fan_status
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.4.2.0
accept_errors: true
default_value: '0'
scan_interval: 30
- platform: snmp
name: nas_name
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.5.1.0
accept_errors: true
default_value: ''
scan_interval: 86400
- platform: snmp
name: nas_serial
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.5.2.0
accept_errors: true
default_value: ''
scan_interval: 86400
- platform: snmp
name: nas_firmware
host: !secret synology_ip
baseoid: 1.3.6.1.4.1.6574.1.5.3.0
accept_errors: true
default_value: ''
scan_interval: 86400
- platform: snmp
name: nas_uptime
host: !secret synology_ip
baseoid: 1.3.6.1.2.1.1.3.0
accept_errors: true
default_value: '0'
scan_interval: 30
value_template: >-
{% set uptime = float(value) / 100 %}
{% set updays = (uptime / 86400) | round(0, "floor") %}
{% set uphours = uptime | timestamp_custom('%-H:%-M:%-S', false) | regex_replace('^0:','') %}
{% if updays == 0 %}
{{- uphours -}}
{% elif updays == 1 %}
{{- updays ~ " Day, " ~ uphours -}}
{% else %}
{{- updays ~ " Days, " ~ uphours -}}
{% endif %}
- platform: waqi
token: !secret waqi_token_key
locations: 'Toronto'
- platform: template
sensors:
aqi:
value_template: "{{ states('sensor.waqi_toronto') }}"
o3:
value_template: "{{ state_attr('sensor.waqi_toronto', 'ozone') }}"
pm:
value_template: "{{ state_attr('sensor.waqi_toronto', 'pm_2_5') }}"
no2:
value_template: "{{ state_attr('sensor.waqi_toronto', 'nitrogen_dioxide') }}"
co:
value_template: "{{ state_attr('sensor.waqi_toronto', 'co') }}"
so2:
value_template: "{{ state_attr('sensor.waqi_toronto', 'sulfur_dioxide') }}"
aqhi_friendly:
friendly_name: AQHI
icon_template: mdi:chemical-weapon
value_template: >-
{% set l = int(0) + states('sensor.aqhi') | int(0) %}
{% if l <= 3 %} Low
{% elif l <= 6 %} Moderate
{% elif l <= 10 %} High
{% elif l > 10 %} Hazardous
{% endif %}
aqi_friendly:
friendly_name: AQI
icon_template: mdi:chemical-weapon
value_template: >-
{% set l = int(0) + states('sensor.aqi') | int(0) %}
{% if l <= 99 %} Low
{% elif l <= 149 %} Moderate
{% elif l <= 199 %} High
{% elif l > 199 %} Hazardous
{% endif %}
o3_friendly:
friendly_name: O₃
icon_template: mdi:earth
value_template: >-
{% set l = int(0) + states('sensor.o3') | int(0) %}
{% if l < 0 %} unknown
{% elif l <= 54 %} Good
{% elif l <= 70 %} Moderate
{% elif l <= 85 %} Unhealthy
{% elif l > 85 %} Hazardous
{% endif %}
pm_friendly:
friendly_name: PM₂.₅
icon_template: mdi:chart-bubble
value_template: >-
{% set l = int(0) + states('sensor.pm') | int(0) %}
{% if l < 0 %} unknown
{% elif l <= 50 %} Good
{% elif l <= 100 %} Moderate
{% elif l <= 300 %} Unhealthy
{% elif l > 300 %} Hazardous
{% endif %}
no2_friendly:
friendly_name: NO₂
icon_template: mdi:car
value_template: >-
{% set l = int(0) + states('sensor.no2') | int(0) %}
{% if l < 0 %} unknown
{% elif l <= 50 %} Good
{% elif l <= 100 %} Moderate
{% elif l <= 200 %} Unhealthy
{% elif l > 200 %} Hazardous
{% endif %}
co_friendly:
friendly_name: CO
icon_template: mdi:fire
value_template: >-
{% set l = float(0) + states('sensor.co') | float(0) %}
{% if l < 0 %} unknown
{% elif l <= 4.4 %} Good
{% elif l <= 9.4 %} Moderate
{% elif l <= 15.4 %} Unhealthy
{% elif l > 15.4 %} Hazardous
{% endif %}
so2_friendly:
friendly_name: SO₂
icon_template: mdi:factory
value_template: >-
{% set l = int(0) + states('sensor.so2') | int(0) %}
{% if l < 0 %} unknown
{% elif l <= 34 %} Good
{% elif l <= 144 %} Moderate
{% elif l <= 304 %} Unhealthy
{% elif l > 304 %} Hazardous
{% endif %}
cigarettes:
friendly_name: Cigarettes / Day
icon_template: mdi:smoking
unit_of_measurement: 'Cigarettes'
value_template: >-
{% if states('sensor.pm').isdigit() %}
{{ ( float(states('sensor.pm')) / 22 ) | round(1) }}
{% else %}
{{ float(0) }}
{% endif %}
ec_current_summary:
friendly_name: Currently
value_template: >-
Currently {{ states('sensor.temperature') }}°C (Feels like {{ states('sensor.feels_like') }}) and {{ states('sensor.ec_current_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_current_icon') }}.gif"
icon_template: >-
mdi:thermometer
ec_1_summary:
friendly_name_template: >-
{{ states('sensor.ec_1_name') }}
value_template: >-
{{ states('sensor.ec_1_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_1_icon') }}.gif"
ec_2_summary:
friendly_name_template: >-
{{ states('sensor.ec_2_name') }}
value_template: >-
{{ states('sensor.ec_2_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_2_icon') }}.gif"
ec_3_summary:
friendly_name_template: >-
{{ states('sensor.ec_3_name') }}
value_template: >-
{{ states('sensor.ec_3_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_3_icon') }}.gif"
ec_4_summary:
friendly_name_template: >-
{{ states('sensor.ec_4_name') }}
value_template: >-
{{ states('sensor.ec_4_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_4_icon') }}.gif"
ec_5_summary:
friendly_name_template: >-
{{ states('sensor.ec_5_name') }}
value_template: >-
{{ states('sensor.ec_5_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_5_icon') }}.gif"
ec_6_summary:
friendly_name_template: >-
{{ states('sensor.ec_6_name') }}
value_template: >-
{{ states('sensor.ec_6_summary_text') }}
entity_picture_template: >-
"https://weather.gc.ca/weathericons/{{ states('sensor.ec_6_icon') }}.gif"
- platform: darksky
api_key: !secret darksky_api_key
forecast:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
monitored_conditions:
- precip_intensity_max
- platform: miflora
name: kitchen
mac: !secret plant1_mac
force_update: true
monitored_conditions:
- battery
- conductivity
- light
- moisture
- temperature
- platform: nextbus
agency: ttc
route: 97
stop: 8543
scan_interval: 60
- platform: template
sensors:
97north:
friendly_name: '97 North'
icon_template: mdi:bus-clock
unit_of_measurement: 'min'
value_template: '{{ state_attr("sensor.ttc_97", "upcoming").split(",")[0] }}'
- platform: rest
name: pi_hole_status
method: GET
resource: !secret pi_hole_status_url
value_template: '{{ value_json.status }}'
input_boolean:
night_mode_bool:
initial: on
switch:
- platform: template
switches:
night_mode:
friendly_name: night
value_template: '{{ states("input_boolean.night_mode_bool") }}'
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.night_mode_bool
turn_off:
- service: automation.trigger
data:
entity_id: automation.night
icon_template: mdi:sleep
toggle_pi_hole:
friendly_name: Toggle Pi-hole
value_template: "{{ is_state('sensor.pi_hole_status', 'on') }}"
turn_on: