-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.yaml
961 lines (940 loc) · 34.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
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
bluetooth:
frontend:
themes: !include_dir_merge_named themes
extra_module_url:
- /local/community/lovelace-card-mod/card-mod.js
/local/autorefresh.js
#Plant Waterer Buttons
mqtt:
button:
- unique_id: waterer_pump_button
name: "Water Plant"
device:
name: "Pico Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
command_topic: "waterer/waterpump"
payload_press: "Requested"
qos: 1
retain: false
- unique_id: waterer_cancel
name: "Cancel Water"
device:
name: "Pico Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
command_topic: "waterer/waterpump"
payload_press: "Cancelled"
qos: 1
retain: false
- unique_id: waterer_reboot
name: "Waterer Reboot"
device:
name: "Pico Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
command_topic: "waterer/waterpump"
payload_press: "Reboot"
qos: 1
retain: false
- unique_id: waterer_config_submit
name: "Waterer Config Submit"
device:
name: "Pico Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
command_topic: "waterer/config"
entity_category: config
payload_press: >
{
"min_moisture": {{ states('input_number.waterer_min_moisture') }},
"max_moisture": {{ states('input_number.waterer_max_moisture') }},
"message_interval": {{ states('input_number.waterer_message_interval') }},
"max_threshold": {{ states('input_number.waterer_max_threshold') }},
"min_threshold": {{ states('input_number.waterer_min_threshold') }},
"max_water_cycles": {{ states('input_number.waterer_max_water_cycles') }},
"pump_on_time": {{ states('input_number.waterer_pump_on_time') }},
"pump_interval": {{ states('input_number.waterer_pump_interval') }},
"reboot_days": {{ states('input_number.waterer_reboot_days') }}
}
qos: 1
retain: true
sensor:
#MQTT Plant Waterer Sensors
- unique_id: waterer_moisture
name: "Waterer Moisture"
device:
name: "Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
state_topic: "waterer/moisture"
unit_of_measurement: "%"
- unique_id: waterer_status
name: "Waterer Status"
device:
name: "Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
state_topic: "waterer/status"
- unique_id: waterer_pump
name: "Waterer Pump"
device:
name: "Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
state_topic: "waterer/waterpump"
- unique_id: waterer_raw
name: "Waterer Raw"
device:
name: "Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
state_topic: "waterer/raw"
- unique_id: waterer_config
name: "Waterer Config"
device:
name: "Waterer"
identifiers: pico_waterer
manufacturer: "Raspberry Pi"
model: "Pico W"
state_topic: "waterer/config"
value_template: "{{ value_json.settings }}"
json_attributes_topic: "waterer/config"
json_attributes_template: "{{ value_json | tojson }}"
#MQTT Dehumidifier Sensor
- name: "EWPE Dehumidifier"
unique_id: ewpe_dehumidifier
device:
name: "Ewpe Dehumidifier"
identifiers: ewpe_dehumidifier
manufacturer: "Lexent"
model: "14L Dehumidifier"
state_topic: "ewpe-smart/502cc6677159/status"
value_template: "{{ value_json }}"
json_attributes_topic: "ewpe-smart/502cc6677159/status"
json_attributes_template: "{{ value_json | tojson }}"
sensor:
# Get time/date
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_utc'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
# Waterer Max/Min
- platform: statistics
name: 'Waterer - Min Check'
unique_id: waterer_min_check
entity_id: sensor.waterer_raw
state_characteristic: value_max
sampling_size: 800
max_age:
days: 28
- platform: statistics
name: 'Waterer - Max Check'
unique_id: waterer_max_check
entity_id: sensor.waterer_raw
state_characteristic: value_min
sampling_size: 800
max_age:
days: 28
command_line:
# Tuya Pet Feeder Record sensor
- sensor:
name: 'Pet Feeder - Record'
unique_id: pet_feeder_record
scan_interval: 300
command_timeout: 30
command: python3 ./pyscript/tuya_feeder_status.py
value_template: '{{ value_json }}'
json_attributes:
- records
- date
- lastTime
- meal_plan
- manual_feed
- fault
- battery
#Candy washer dryer sensor
- sensor:
name: 'Candy Washer Dryer'
unique_id: candy_washer_dryer
scan_interval: 60
command_timeout: 30
command: python3 ./pyscript/candy.py
value_template: '{{ value_json }}'
json_attributes:
- WiFiStatus
- Err
- MachMd
- Pr
- PrPh
- Temp
- SpinSp
- RemTime
- DryT
- DelVal
- TotalTime
shell_command:
pet_feeder_feed: python3 ./pyscript/tuya_feeder_send.py feed
pet_feeder_plan: python3 ./pyscript/tuya_feeder_send.py {{ states('sensor.pet_feeder_new_plan') }}
switch:
#living room fan heater switch
- platform: template
switches:
living_room_fan_heater:
friendly_name: "Living Room - Fan Heater"
unique_id: living_room_fan_heater
icon_template: mdi:fan
value_template: "{{ states('climate.fan_heater') }}"
turn_on:
service: climate.turn_on
target:
entity_id: climate.fan_heater
turn_off:
service: climate.turn_off
target:
entity_id: climate.fan_heater
#dehumidifier switches
ewpe_dehumidifier_power:
friendly_name: 'EWPE Dehumidifier Power'
unique_id: ewpe_dehumidifier_power
icon_template: mdi:power
value_template: >
{% set Power = state_attr('sensor.ewpe_dehumidifier','Pow') %}
{% if Power == 1 %}On
{% else %}Off
{% endif %}
turn_on:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Pow":1}'
turn_off:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Pow":0}'
ewpe_dehumidifier_fan:
friendly_name: 'EWPE Dehumidifier Fan'
unique_id: ewpe_dehumidifier_fan
icon_template: mdi:fan
value_template: >
{% set Fan = state_attr('sensor.ewpe_dehumidifier','WdSpd') %}
{% if Fan == 3 %}On
{% else %}Off
{% endif %}
turn_on:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"WdSpd":3}'
turn_off:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"WdSpd":1}'
ewpe_dehumidifier_health:
friendly_name: 'EWPE Dehumidifier Health'
unique_id: ewpe_dehumidifier_health
icon_template: mdi:bottle-tonic-plus
value_template: >
{% set Health = state_attr('sensor.ewpe_dehumidifier','Health') %}
{% if Health == 1 %}On
{% else %}Off
{% endif %}
turn_on:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Health":1}'
turn_off:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Health":0}'
ewpe_dehumidifier_led:
friendly_name: 'EWPE Dehumidifier Light'
unique_id: ewpe_dehumidifier_light
icon_template: mdi:led-outline
value_template: >
{% set Light = state_attr('sensor.ewpe_dehumidifier','Lig') %}
{% if Light == 0 %}Off
{% else %}On
{% endif %}
turn_on:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Lig":1}'
turn_off:
service: mqtt.publish
data:
topic: ewpe-smart/502cc6677159/set
payload: '{"Lig":0}'
##Template - Sensors
template:
# Date
- sensor:
- name: 'date long'
state: "{{ as_timestamp(states('sensor.date')) | timestamp_custom('%a %-d %b %Y') }}"
# Unix Dates/Times
- sensor:
- name: 'Unix Today'
state: "{{ (as_timestamp(states('sensor.date'))*1000) | int }}"
- sensor:
- name: 'Unix Tomorrow'
state: "{{ ((as_timestamp(states('sensor.date'))+86400)*1000) | int }}"
# Extract temperature from Living Room Fan Heater
- sensor:
- name: 'Living Room - Temp'
unique_id: living_room_temp
icon: mdi:thermometer
unit_of_measurement: '°C'
state: "{{ state_attr('climate.fan_heater','current_temperature') | int }}"
# Walk timer
- sensor:
- name: Walk Duration
unique_id: walk_duration
state: >
{% set Active = states('input_boolean.walk_active') %}
{% set Start = as_timestamp(states('input_datetime.walk_start_datetime')) | int %}
{% set End = as_timestamp(states('input_datetime.walk_end_datetime')) | int %}
{{ ((End - Start)/60) | int }}
unit_of_measurement: mins
- sensor:
- name: Walk Money
unique_id: walk_money
state: "{{'{:.2f}'.format(states('sensor.walk_duration') | float(2) * 0.003) }}"
- sensor:
- name: Walk Money String
unique_id: walk_money_string
state: "£{{ '{:.2f}'.format(states('sensor.walk_money') | float(2)) }}"
- sensor:
- name: Walk Total Money String
unique_id: walk_total_money_string
state: "£{{ states('input_number.walk_total_money') }}"
# Pet Feeder sensors from Cloud API
- sensor:
- name: 'Pet Feeder - Error Text'
unique_id: pet_feeder_error_text
icon: mdi:alert-circle-outline
state: >
{% set error = state_attr('sensor.pet_feeder_record','fault') %}
{% if error == 0 %}No Errors
{% elif error == 1 %}Low Food
{% else %}{{error}}
{% endif %}
- sensor:
- name: 'Pet Feeder - Battery'
unique_id: pet_feeder_battery
state: >
{% set batt = state_attr('sensor.pet_feeder_record','battery') %}
{% if batt == 'empty' %}Empty
{% elif batt == 'low' %}Low
{% elif batt == 'full' %}Full
{% else %}{{ batt }}
{% endif %}
icon: >
{% set batt = state_attr('sensor.pet_feeder_record','battery') %}
{% if batt == 'empty' %}mdi:battery-alert-variant-outline
{% elif batt == 'low' %}mdi:battery-low
{% elif batt == 'full' %}mdi:battery-high
{% else %}mdi:battery-medium
{% endif %}
- sensor:
- name: 'Pet Feeder - Manual Feed'
unique_id: pet_feeder_manual
icon: mdi:bowl-mix
state: "{{ state_attr('sensor.pet_feeder_record', 'manual_feed') }}"
- sensor:
- name: "Pet Feeder - Feed Total"
unique_id: pet_feeder_feed_total
icon: mdi:bowl-mix
state: "{{ state_attr('sensor.pet_feeder_record', 'records') | int(default=0) }}"
- sensor:
- name: "Pet Feeder - Record Date Unix"
unique_id: pet_feeder_record_date_unix
state: "{{ state_attr('sensor.pet_feeder_record', 'date') }}"
- sensor:
- name: "Pet Feeder - Record Date"
unique_id: pet_feeder_record_date
state: >
{% set Date = state_attr('sensor.pet_feeder_record', 'date') %}
{% if Date == 'None' %}None
{% else %}{{ Date | timestamp_custom('%d-%m-%Y') }}
{% endif %}
- sensor:
- name: "Pet Feeder - Last Feed Unix"
unique_id: pet_feeder_last_feed_unix
state: "{{ state_attr('sensor.pet_feeder_record', 'lastTime') }}"
- sensor:
- name: Pet Feeder - Last Feed
unique_id: pet_feeder_last_feed
state: >
{% set Last = state_attr('sensor.pet_feeder_record', 'lastTime') %}
{% if Last == 'None' %}None
{% else %}{{ Last | timestamp_custom('%H:%M') }}
{% endif %}
- sensor:
- name: "Pet Feeder - Active Time"
unique_id: pet_feeder_active_time
icon: mdi:calendar
state: "{{ (states('input_number.pet_feeder_last_feed')|float) - (states('input_number.pet_feeder_first_feed')|float) }}"
- sensor:
- name: "Pet Feeder - Feeds Due"
unique_id: pet_feeder_feeds_due
icon: mdi:bowl-mix-outline
state: >
{% set now = as_timestamp(now()) | int %}
{% set today = as_timestamp(states('sensor.date')) | int %}
{% set firstFeed = today + states('input_number.pet_feeder_first_feed') | int * 3600 %}
{% set lastFeed = today + states('input_number.pet_feeder_last_feed') | int * 3600 %}
{% set activeTime = states('sensor.pet_feeder_active_time') | float %}
{% set feedInterval = (activeTime / (states('input_number.pet_feeder_feeds_day') | int - 1) *60*60) %}
{% if now < firstFeed %}0
{% elif now > lastFeed %}{{ states('input_number.pet_feeder_feeds_day') | int }}
{% else %}{{ (((now - firstFeed) | float) / (feedInterval | float)) | int + 1 }}
{% endif %}
- sensor:
- name: "Pet Feeder - Feed Status"
unique_id: pet_feeder_feed_status
icon: mdi:cookie-clock
state: >
{% set now = as_timestamp(now()) | int %}
{% set today = as_timestamp(states('sensor.date')) | int %}
{% set firstFeed = today + states('input_number.pet_feeder_first_feed') | int * 3600 %}
{% set lastFeed = today + states('input_number.pet_feeder_last_feed') | int * 3600 %}
{% set activeTime = states('sensor.pet_feeder_active_time') | float %}
{% set feedInterval = (activeTime / (states('input_number.pet_feeder_feeds_day') | int - 1) *60*60) %}
{% set feedsDone = states('sensor.pet_feeder_feed_total') | int %}
{% set feedsDue = states('sensor.pet_feeder_feeds_due') | int %}
{% set nextScheduled = firstFeed + feedsDue * feedInterval %}
{% if (nextScheduled - now) / 3600 > 1 %}{% set timeUntilFeed = '%0.1f hrs' % ((nextScheduled - now) / 3600 | float) %}
{% else %}{% set timeUntilFeed = '%d mins' % ((nextScheduled - now) / 60) %}
{% endif %}
{% if feedsDue > feedsDone %}Feed Due
{% elif feedsDue == feedsDone %}{{ "Due in: " + timeUntilFeed }}
{% else %}{{ "Ahead: " + timeUntilFeed }}
{% endif %}
- sensor:
- name: 'Pet Feeder - Meal Plan'
unique_id: pet_feeder_meal_plan
icon: mdi:notebook-outline
state: "{{ state_attr('sensor.pet_feeder_record', 'meal_plan') }}"
- sensor:
- name: Pet Feeder - Meal Plan Numbers
unique_id: pet_feeder_meal_plan_numbers
icon: mdi:notebook-outline
state: >
{% set Plan = states('sensor.pet_feeder_meal_plan') %}
{% set KeyList = states('sensor.key_converter') %}
{% set ns = namespace(Nums = KeyList.index(Plan[0])) %}
{% for i in range(1,32) %}
{% set ns.Nums = ns.Nums ~ ',' ~ KeyList.index(Plan[i]) %}
{% endfor %}
{{ ns.Nums }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 1 - Power
unique_id: pet_feeder_slot1_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO1 = (Nums.split(',')[5] | int) / 16 | int %}
{% if IO1 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 1 - Portions
unique_id: pet_feeder_slot1_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por1 = Nums.split(',')[3] | int %}
{{ Por1 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 1 - Time
unique_id: pet_feeder_slot1_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour1 = ((Nums.split(',')[0]|int)*4 + (Nums.split(',')[1]|int)/16) | int %}
{% set Min1 = ((Nums.split(',')[2]|int)/4 + (Nums.split(',')[1]|int) % 16|int *16) | int %}
{{ Hour1 }}:{{ '{:02}'.format(Min1) }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 2 - Power
unique_id: pet_feeder_slot2_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO2 = (Nums.split(',')[10]|int) / 4 %}
{% if IO2 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 2 - Portions
unique_id: pet_feeder_slot2_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por2 = ((Nums.split(',')[9]|int/16) + (Nums.split(',')[8]|int*4)) | int %}
{{ Por2 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 2 - Time
unique_id: pet_feeder_slot2_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour2 = (Nums.split(',')[6]|int/4 + Nums.split(',')[5]|int%16*16) | int %}
{% set Min2 = Nums.split(',')[7]|int %}
{{ Hour2 }}:{{ '{:02}'.format(Min2) }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 3 - Power
unique_id: pet_feeder_slot3_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO3 = Nums.split(',')[15]|int %}
{% if IO3 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 3 - Portions
unique_id: pet_feeder_slot3_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por3 = (Nums.split(',')[14]|int/4 + Nums.split(',')[13]|int%16*16) | int %}
{{ Por3 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 3 - Time
unique_id: pet_feeder_slot3_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour3 = Nums.split(',')[11]|int %}
{% set Min3 = ((Nums.split(',')[13]|int/16) % 16 + Nums.split(',')[12]|int*4) | int %}
{{ Hour3 }}:{{ '{:02}'.format(Min3) }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 4 - Power
unique_id: pet_feeder_slot4_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO4 = (Nums.split(',')[21] | int) / 16 | int %}
{% if IO4 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 4 - Portions
unique_id: pet_feeder_slot4_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por4 = (Nums.split(',')[19]) | int %}
{{ Por4 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 4 - Time
unique_id: pet_feeder_slot4_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour4 = ((Nums.split(',')[16]|int)*4 + (Nums.split(',')[17]|int)/16) | int %}
{% set Min4 = ((Nums.split(',')[18]|int)/4 + ((Nums.split(',')[17]|int)%16 | int *16)) | int %}
{{ Hour4 }}:{{ '{:02}'.format(Min4) }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 5 - Power
unique_id: pet_feeder_slot5_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO5 = (Nums.split(',')[26]|int) / 4 %}
{% if IO5 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 5 - Portions
unique_id: pet_feeder_slot5_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por5 = ((Nums.split(',')[25]|int/16) + (Nums.split(',')[24]|int*4)) | int %}
{{ Por5 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 5 - Time
unique_id: pet_feeder_slot5_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour5 = (Nums.split(',')[22]|int/4 + Nums.split(',')[21]|int%16*16) | int %}
{% set Min5 = Nums.split(',')[23]|int %}
{{ Hour5 }}:{{ '{:02}'.format(Min5) }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 6 - Power
unique_id: pet_feeder_slot6_power
icon: mdi:power
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set IO6 = Nums.split(',')[31]|int %}
{% if IO6 == 1 %}On
{% else %}Off
{% endif %}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 6 - Portions
unique_id: pet_feeder_slot6_portions
icon: mdi:numeric
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Por6 = (Nums.split(',')[30]|int/4 + Nums.split(',')[29]|int%16*16) | int %}
{{ Por6 }}
- sensor:
- name: Pet Feeder - Meal Plan - Slot 6 - Time
unique_id: pet_feeder_slot6_time
icon: mdi:clock-digital
state: >
{% set Nums = states('sensor.pet_feeder_meal_plan_numbers') %}
{% set Hour6 = Nums.split(',')[27]|int %}
{% set Min6 = ((Nums.split(',')[29]|int/16) % 16 + Nums.split(',')[28]|int*4) | int %}
{{ Hour6 }}:{{ '{:02}'.format(Min6) }}
- sensor:
- name: Pet Feeder - New Plan Numbers
unique_id: pet_feed_new_plan_numbers
icon: mdi:numeric
state: >
{% set Slot1Time = states('input_text.pet_feeder_slot_1_time') %}
{% set Slot1Hr = Slot1Time.split(':')[0] | int %}
{% set Slot1Min = Slot1Time.split(':')[1] | int %}
{% set Slot1 = states('input_boolean.pet_feeder_slot_1_power') %}
{% if Slot1 == "on" %}
{% set Slot1Power = 1 %}
{% else %}
{% set Slot1Power = 0 %}
{% endif %}
{% set Slot2Time = states('input_text.pet_feeder_slot_2_time') %}
{% set Slot2Hr = Slot2Time.split(':')[0] | int %}
{% set Slot2Port = states('input_number.pet_feeder_slot_2_portions') | int %}
{% set Slot2 = states('input_boolean.pet_feeder_slot_2_power') %}
{% if Slot2 == "on" %}
{% set Slot2Power = 1 %}
{% else %}
{% set Slot2Power = 0 %}
{% endif %}
{% set Slot3Time = states('input_text.pet_feeder_slot_3_time') %}
{% set Slot3Min = Slot3Time.split(':')[1] | int %}
{% set Slot3Port = states('input_number.pet_feeder_slot_3_portions') | int %}
{% set Slot3Power = states('input_boolean.pet_feeder_slot_3_power') %}
{% if Slot3Power == "on" %}
{% set Num15 = 1 %}
{% else %}
{% set Num15 = 0 %}
{% endif %}
{% set Slot4Time = states('input_text.pet_feeder_slot_4_time') %}
{% set Slot4Hr = Slot4Time.split(':')[0] | int %}
{% set Slot4Min = Slot4Time.split(':')[1] | int %}
{% set Slot4 = states('input_boolean.pet_feeder_slot_4_power') %}
{% if Slot4 == "on" %}
{% set Slot4Power = 1 %}
{% else %}
{% set Slot4Power = 0 %}
{% endif %}
{% set Slot5Time = states('input_text.pet_feeder_slot_5_time') %}
{% set Slot5Hr = Slot5Time.split(':')[0] | int %}
{% set Slot5Port = states('input_number.pet_feeder_slot_5_portions') | int %}
{% set Slot5Power = states('input_boolean.pet_feeder_slot_5_power') %}
{% if Slot5Power == "on" %}
{% set Slot5Power = 1 %}
{% else %}
{% set Slot5Power = 0 %}
{% endif %}
{% set Slot6Time = states('input_text.pet_feeder_slot_6_time') %}
{% set Slot6Min = Slot6Time.split(':')[1] | int %}
{% set Slot6Port = states('input_number.pet_feeder_slot_6_portions') | int %}
{% set Slot6Power = states('input_boolean.pet_feeder_slot_6_power') %}
{% if Slot6Power == "on" %}
{% set Num31 = 1 %}
{% else %}
{% set Num31 = 0 %}
{% endif %}
{% set Num0 = (Slot1Hr/4) | int %}
{% set Num1 = ((Slot1Hr%4)*16 + Slot1Min/16) | int %}
{% set Num2 = (Slot1Min%16/4) | int %}
{% set Num3 = states('input_number.pet_feeder_slot_1_portions') | int %}
{% set Num5 = (Slot1Power*16) + ((Slot2Hr/16)|int) | int %}
{% set Num6 = ((Slot2Hr - (((Slot2Hr/16) |int)*16))*4) | int %}
{% set Num7 = Slot2Time.split(':')[1] | int %}
{% set Num8 = (Slot2Port/4) | int %}
{% set Num9 = (Slot2Port%4*16) | int %}
{% set Num10 = (Slot2Power*4) | int %}
{% set Num11 = Slot3Time.split(':')[0] | int %}
{% set Num12 = (Slot3Min/4) | int %}
{% set Num13 = ((Slot3Min%4)*16 + ((Slot3Port/16)|int)) | int %}
{% set Num14 = ((Slot3Port%16)*4) | int %}
{% set Num16 = (Slot4Hr/4) | int %}
{% set Num17 = ((Slot4Hr%4)*16 + Slot4Min/16) | int %}
{% set Num18 = (Slot4Min%16/4) | int %}
{% set Num19 = states('input_number.pet_feeder_slot_4_portions') | int %}
{% set Num21 = (Slot4Power*16) + ((Slot5Hr/16)|int) | int %}
{% set Num22 = ((Slot5Hr - (((Slot5Hr/16) |int)*16))*4) | int %}
{% set Num23 = Slot5Time.split(':')[1] | int %}
{% set Num24 = (Slot5Port/4) | int %}
{% set Num25 = (Slot5Port%4*16) | int %}
{% set Num26 = (Slot5Power*4) | int %}
{% set Num27 = Slot6Time.split(':')[0] | int %}
{% set Num28 = (Slot6Min/4) | int %}
{% set Num29 = ((Slot6Min%4)*16 + ((Slot6Port/16)|int)) | int %}
{% set Num30 = ((Slot6Port%16)*4) | int %}
{% set NewNums = Num0~','~Num1~','~Num2~','~Num3~',0,'~Num5~','~Num6~','~Num7~','~Num8~','~Num9~','~Num10~','~Num11~','~Num12~','~Num13~','~Num14~','~Num15~','~Num16~','~Num17~','~Num18~','~Num19~',0,'~Num21~','~Num22~','~Num23~','~Num24~','~Num25~','~Num26~','~Num27~','~Num28~','~Num29~','~Num30~','~Num31 %}
{{ NewNums }}
- sensor:
- name: Pet Feeder - New Plan
unique_id: pet_feeder_new_plan
icon: mdi:notebook-outline
state: >
{% set NewPlanNums = states('sensor.pet_feeder_new_plan_numbers') %}
{% set KeyList = states('sensor.key_converter') %}
{% set ns = namespace(Letters = "") %}
{% for i in range(0,32) %}
{% set ns.Letters = ns.Letters ~ KeyList[NewPlanNums.split(',')[i]|int] %}
{% endfor %}
{{ ns.Letters }}
# Washer Dryer
- sensor:
- name: 'Washer/Dryer - WiFi'
unique_id: washer_dryer_wifi
icon: mdi:washing-machine
state: >
{% set WiFi = state_attr('sensor.candy_washer_dryer', 'WiFiStatus') | default(1) %}
{% if WiFi == '0' %}On
{% elif WiFi == '1' %}Off
{% else %}{{ WiFi }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Error'
unique_id: washer_dryer_error
icon: mdi:alert-circle
state: >
{% set Error = state_attr('sensor.candy_washer_dryer', 'Err') | default(255) %}
{% if Error == '255' %}No Errors
{% elif Error is number %}{{ Error }}
{% else %}Off
{% endif %}
- sensor:
- name: 'Washer/Dryer - Status'
unique_id: washer_dryer_status
icon: mdi:chart-pie
state: >
{% set Status = state_attr('sensor.candy_washer_dryer', 'MachMd') %}
{% if Status == "1" %}Not Started
{% elif Status == "2" %}Running
{% elif Status == "3" %}Paused
{% elif Status == "4" %}Setting Up
{% elif Status == "5" %}Delayed
{% elif Status == "7" %}Finished
{% elif Status == None %}Off
{% else %}{{ Status }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Program'
unique_id: washer_dryer_program
icon: mdi:progress-star
state: >
{% set Prog = state_attr('sensor.candy_washer_dryer', 'Pr') %}
{% if Prog == "1" %}Special
{% elif Prog == "2" %}Cotton
{% elif Prog == "3" %}Colour
{% elif Prog == "4" %}Daily
{% elif Prog == "5" %}Rapid
{% elif Prog == "9" %}Spin/ Drain
{% elif Prog == "11" %}Bed Linen
{% elif Prog == "12" %}Dry Low
{% elif Prog == "13" %}Dry High
{% elif Prog == "14" %}Rapid W&D
{% elif Prog == "17" %}Hygeine
{% elif Prog == None %}Off
{% else %}{{ Prog }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Phase'
unique_id: washer_dryer_phase
icon: mdi:progress-question
state: >
{% set Phase = state_attr('sensor.candy_washer_dryer', 'PrPh') %}
{% if Phase == "0" %}Delayed
{% elif Phase == "1" %}Prewash
{% elif Phase == "2" %}Wash
{% elif Phase == "3" %}Rinse
{% elif Phase == "4" %}Spin/ Drain
{% elif Phase == "5" %}End
{% elif Phase == "6" %}Drying
{% elif Phase == "7" %}Error
{% elif Phase == "8" %}Steam
{% elif Phase == "9" %}Goodnight
{% elif Phase == "10" %}Spin
{% elif Phase == None %}Off
{% else %}{{ Phase }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Wash Temp'
unique_id: washer_dryer_temp
icon: mdi:thermometer-lines
unit_of_measurement: '°C'
state: >
{% set Temp = state_attr('sensor.candy_washer_dryer', 'Temp') %}
{% if Temp == None %}0
{% elif Temp == "0" %}0
{% else %}{{ Temp }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Spin Speed'
unique_id: washer_dryer_spin_speed
icon: mdi:speedometer
unit_of_measurement: rpm
state: >
{% set Spin = state_attr('sensor.candy_washer_dryer', 'SpinSp') %}
{% if Spin == None %}0
{% elif Spin == "0" %}0
{% else %}{{ (Spin | int) * 100 }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Wash Time'
unique_id: washer_dryer_wash_time
icon: mdi:timer
unit_of_measurement: 'mins'
state: >
{% set WashT = state_attr('sensor.candy_washer_dryer', 'RemTime') %}
{% if WashT == None %}0
{% else %}{{ WashT | int }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Dry Time'
unique_id: washer_dryer_dry_time
icon: mdi:clock-time-four
state: >
{% set DryT = state_attr('sensor.candy_washer_dryer', 'DryT') %}
{% if DryT == None %}Off
{% elif DryT == "0" %}Dry Off
{% elif DryT == "3" %}Iron Dry
{% elif DryT == "4" %}Dry Finished
{% elif DryT == "5" %}Dry Ending
{% else %}{{ DryT }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Delay Time'
unique_id: washer_dryer_delay_time
icon: mdi:timer
unit_of_measurement: 'hours'
state: >
{% set DelT = state_attr('sensor.candy_washer_dryer', 'DelVal') %}
{% if DelT == None %}0
{% else %}{{ DelT | int }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Total Time'
unique_id: washer_dryer_total_time
icon: mdi:timer
state: >
{% set TotalT = state_attr('sensor.candy_washer_dryer', 'TotalTime') %}
{% if TotalT == None %}0
{% else %}{{ TotalT }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Max Delay'
unique_id: washer_dryer_max_delay
icon: mdi:timer
state: >
{% set Status = states('sensor.washer_dryer_wifi') %}
{% set Delay = states('sensor.washer_dryer_delay_time') | int(default=0) * 60 %}
{% set DelayMax = states('sensor.washer_dryer_max_delay') | int(default=0) %}
{% set Total = states('sensor.washer_dryer_total_time') | int(default=0) %}
{% if Total == 0 %}0
{% elif Status == 'Off' %}{{ DelayMax }}
{% elif DelayMax >= Delay %}{{ DelayMax }}
{% else %}{{ Delay }}
{% endif %}
- sensor:
- name: 'Washer/Dryer - Max Time'
unique_id: washer_dryer_max_time
icon: mdi:timer
state: >
{% set Status = states('sensor.washer_dryer_wifi') %}
{% set Total = states('sensor.washer_dryer_total_time') | int(default=0) %}
{% set TMax = states('sensor.washer_dryer_max_time') | int(default=0) %}
{% set DelayMax = states('sensor.washer_dryer_delay_max') | int(default=0) %}
{% if Total == 0 %}0
{% elif Status == 'Off' %}{{ TMax }}
{% elif Total <= (TMax - DelayMax) %}{{ TMax }}
{% else %}{{ Total }}
{% endif %}
# EWPE Dehumidifier
- sensor:
- name: 'EWPE Dehumidifier Humidity'
unique_id: ewpe_dehumidifier_humidity
icon: mdi:cloud-percent
state: "{{ state_attr('sensor.ewpe_dehumidifier','DwatSen') | int(default=0) }}"
unit_of_measurement: '%'
- sensor:
- name: 'EWPE Dehumidifier Target Humidity'
unique_id: ewpe_dehumidifier_target_humidity
icon: mdi:cloud-percent
state: "{{ (state_attr('sensor.ewpe_dehumidifer','Dwet')|int(default=0)) * 5 + 30 }}"
unit_of_measurement: '%'
- sensor:
- name: 'EWPE Dehumidifier Mode'
unique_id: ewpe_dehumidifier_mode
icon: mdi:list-box-outline
state: >
{% set Mode = state_attr('sensor.ewpe_dehumidifier','Dmod') %}
{% if Mode == 0 %}Home
{% elif Mode == 1 %}Away
{% else %}Unknown {{ Mode }}
{% endif %}
- sensor:
- name: 'EWPE Dehumidifier Full'
unique_id: ewpe_dehumidifier_full
icon: mdi:gauge-full
state: >
{% set Full = state_attr('sensor.ewpe_dehumidifier','DwatFul') %}
{% if Full == 0 %}OK
{% elif Full == 1 %}Full
{% else %}{{ Full }}
{% endif %}
- sensor:
- name: 'EWPE Dehumidifier Filter'
unique_id: ewpe_dehumidifier_filter
icon: mdi:air-filter
state: >
{% set Filter = state_attr('sensor.ewpe_dehumidifier','Dfltr') %}
{% if Filter == 0 %}OK
{% elif Filter == 1 %}Change
{% else %}{{ Filter }}
{% endif %}
- sensor:
- name: 'EWPE Dehumidifier Temp'
unique_id: ewpe_dehumidifier_temp
icon: mdi:thermometer
state: "{{ state_attr('sensor.ewpe_dehumidifier','TemSen') }}"
unit_of_measurement: '°C'
- sensor:
- name: 'EWPE Dehumidifier Error'
unique_id: ewpe_dehumidifier_error
icon: mdi:alert-octagon
state: "{{ state_attr('sensor.ewpe_dehumidifier','AllErr') }}"