-
Notifications
You must be signed in to change notification settings - Fork 30
/
wm-d1mini_izar-wmbus.yaml
executable file
·875 lines (802 loc) · 26.4 KB
/
wm-d1mini_izar-wmbus.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
## ######################################################
## DEVELOPER TEST VERSION component.maciekn
## HARDWARE: D1 MINI ESP8266 80MHz, 80KB RAM, 4MB Flash
##
## uses:
## - lib maciekn
## - lib backup
## - lib syslog
## ######################################################
substitutions:
# device settings
device_name_short: "water-meter-izar"
device_description: "Wasserzähler Wemos D1 Min, CUL - CC1101, IZAR module (Diehl IZAR RC 868 I R4 PL) Developer Version maciekn"
projectname: "Diehl IZAR RC 868.Watermeter"
appversion: "1.1.7"
# my watermeter id (change this to your watermeter ID)
myWaterMeterID: "43430778"
# my watermeter id (change this to see all watermeters)
# myWaterMeterID: "0"
# log settings
log_level: "DEBUG" # use VERBOSE mode to find the meterId 0x43430778
## ----------------------------------------------------------------
## HARDWARE: D1 MINI ESP8266 80MHz, 80KB RAM, 4MB Flash
## ----------------------------------------------------------------
esp8266:
board: d1_mini
restore_from_flash: true
## ----------------------------------------------------------------
## ESP HOME Configuration
## ----------------------------------------------------------------
esphome:
name: ${device_name_short}
comment: ${device_description}
# Automatically add the mac address to the name
# so you can use a single firmware for all devices
name_add_mac_suffix: false
project:
name: ${projectname}
version: ${appversion}
includes:
- custom_components/izar_meter.h
libraries:
- SPI
- "https://github.com/maciekn/izar-wmbus-esp.git"
- "https://github.com/bblanchon/ArduinoJson.git"
build_path: ./build/${device_name_short}
on_boot:
- priority: -100.00
then:
- globals.set:
id: boot_counter
value: !lambda "return id(boot_counter)+=1;"
- logger.log:
level: WARN
tag: "system"
format: "BOOTMESSAGE:${device_name_short} API is connected, Device ready!"
- component.update: bootcounter
- priority: 700
then:
- logger.log:
level: WARN
tag: "system"
format: "BOOTMESSAGE:${device_name_short} hardware initialization of vital components is executed "
on_shutdown:
priority: 700
then:
- logger.log:
level: ERROR
tag: "system"
format: "BOOTMESSAGE:${device_name_short} is down!"
external_components:
# use local component from
# https://github.com/TheStaticTurtle/esphome_syslog
- source:
type: local
path: custom_components
components: [syslog]
# use local version
# source from https://github.com/dentra/esphome-components
- source:
type: local
path: custom_components
components: [backup]
# ----------------------------------------------------------------
# Save your ESPHome device configuration in firmware and and
# recover it if you lost source files.
# ----------------------------------------------------------------
# Just download it from http://water-meter-izar.local/config.yaml
backup:
auth:
username: !secret web_username
password: !secret web_password
force_update: false
## ---------------------------------------------------
## syslog service
## ---------------------------------------------------
syslog:
ip_address: !secret syslog_server
port: !secret syslog_port
min_level: DEBUG
enable_logger: true
# ----------------------------------------------------------------
# Global variables
# ----------------------------------------------------------------
globals:
- id: boot_counter
type: int
restore_value: yes
initial_value: "0"
- id: mywatermeter_id
type: std::string
restore_value: no
initial_value: '"${myWaterMeterID}"'
- id: watermeter_display_m3
type: float
restore_value: yes
initial_value: "0.00"
- id: last_value
type: float
restore_value: yes
initial_value: "0.00"
- id: current_value
type: float
restore_value: yes
initial_value: "0.00"
- id: hour_value
type: float
restore_value: yes
initial_value: "0.00"
- id: daily_value
type: float
restore_value: yes
initial_value: "0.00"
- id: yesterday_value
type: float
restore_value: yes
initial_value: "0.00"
- id: week_value
type: float
restore_value: yes
initial_value: "0.00"
- id: month_value
type: float
restore_value: yes
initial_value: "0.00"
- id: lastmonth_value
type: float
restore_value: yes
initial_value: "0.00"
- id: year_value
type: float
restore_value: yes
initial_value: "0.00"
## ---------------------------------------------------
## LOGGER
## TODO: how to set the loglevel on runtime ?
## ---------------------------------------------------
logger:
id: appslogger
level: ${log_level}
baud_rate: 0 #disable logging via UART.
## ---------------------------------------------------
## WIFI Settings 3 wifis
## ---------------------------------------------------
wifi:
networks:
- ssid: !secret ssid1_name
password: !secret ssid1_pswd
priority: 0
- ssid: !secret ssid2_name
password: !secret ssid2_pswd
priority: 1
- ssid: !secret ssid3_name
password: !secret ssid3_pswd
priority: 2
domain: !secret domain
## ---------------------------------------------------
## mDNS Component
## ---------------------------------------------------
mdns:
# if mDNS is disabled, they will no longer be able to automatically find your devices.
disabled: false
# ---------------------------------------------------
## Home Assistant API COMPONENT
## Homeassistant service call (all values in liter):
## ---------------------------------------------------
# Homeassistant service call:
# service: esphome.water_meter_set_water_val
# data:
# water_val_hour: 0.03
# water_val_day: 0.248
# water_val_yesterday: 0.178
# water_val_week: 0.248
# water_val_month: 1.94
# water_val_year: 14.256
# water_val_lastmonth: 9.59
## ---------------------------------------------------
api:
id: espapiwm_izar
port: 6053
reboot_timeout: 0s
services:
- service: set_izar_data
variables:
water_val_hour: float
water_val_day: float
water_val_yesterday: float
water_val_week: float
water_val_month: float
water_val_year: float
water_val_lastmonth: float
then:
- globals.set:
id: hour_value
value: !lambda |-
if((water_val_hour) and (water_val_hour)>0.001){
ESP_LOGI("system", "Set hourly value to: %f", water_val_hour);
return (water_val_hour);
}else{
ESP_LOGI("system", "Skip setting hourly value");
return id(hour_value);
};
id(waterhour).publish_state(id(hour_value));
- globals.set:
id: daily_value
value: !lambda |-
if((water_val_day) and (water_val_day)>0.001){
ESP_LOGI("system", "Set daily value to: %f", water_val_day);
return (water_val_day);
}else{
ESP_LOGI("system", "Skip setting hourly value");
return id(hour_value);
};
id(waterday).publish_state(id(daily_value));
- globals.set:
id: yesterday_value
value: !lambda |-
if((water_val_yesterday) and (water_val_yesterday)>0.001){
ESP_LOGI("system", "Set yesterday value to: %f", water_val_yesterday);
return (water_val_yesterday);
}else{
ESP_LOGI("system", "Skip setting yesterday value");
return id(yesterday_value);
};
id(wateryesterday).publish_state(id(hour_value));
- globals.set:
id: week_value
value: !lambda |-
if((water_val_week) and (water_val_week)>0.001){
ESP_LOGI("system", "Set weekly value to: %f", water_val_week);
return (water_val_week);
}else{
ESP_LOGI("system", "Skip setting weekly value");
return id(week_value);
};
id(waterweek).publish_state(id(week_value));
- globals.set:
id: month_value
value: !lambda |-
if((water_val_month) and (water_val_month)>0.001){
ESP_LOGI("system", "Set last montj value to: %f", water_val_month);
return (water_val_month);
}else{
ESP_LOGI("system", "Skip setting monthly value");
return id(week_value);
};
id(watermonth).publish_state(id(month_value));
- globals.set:
id: lastmonth_value
value: !lambda |-
if((water_val_lastmonth) and (water_val_lastmonth)>0.001){
ESP_LOGI("system", "Set last month value to: %f", water_val_lastmonth);
return (water_val_lastmonth);
}else{
ESP_LOGI("system", "Skip setting last month value");
return id(lastmonth_value);
};
id(waterlastmonth).publish_state(id(lastmonth_value));
- globals.set:
id: year_value
value: !lambda |-
if((water_val_year) and (water_val_year)>0.001){
ESP_LOGI("system", "Set last yearly value to: %f", water_val_year);
return (water_val_year);
}else{
ESP_LOGI("system", "Skip setting last yearly value");
return id(week_value);
};
id(wateryear).publish_state(id(year_value));
- logger.log:
tag: "system"
format: "All new Values set: hour: %.1f, day: %.1f, week: %.1f, month: %.1f, lastmonth: %.1f, year: %.1f"
level: INFO
args:
[
"id(hour_value)",
"id(daily_value)",
"id(week_value)",
"id(month_value)",
"id(lastmonth_value)",
"id(year_value)",
]
## ---------------------------------------------------
## OTA Updates
## ---------------------------------------------------
ota:
password: !secret ota_pswd
safe_mode: false
on_begin:
then:
- logger.log:
format: "OTA Start"
tag: "OTA"
level: WARN
on_progress:
then:
- logger.log:
level: WARN
tag: "OTA"
format: "OTA progress %0.1f%%"
args: ["x"]
on_end:
then:
- logger.log:
format: "OTA End"
tag: "OTA"
level: WARN
on_error:
then:
- logger.log:
format: "OTA update error %d"
tag: "OTA"
level: ERROR
args: ["x"]
## ---------------------------------------------------
## The captive portal component in ESPHome is a
## fallback mechanism for when connecting to the
## configured WiFi fails.
## ---------------------------------------------------
captive_portal:
## ---------------------------------------------------
## COMPONENT WEBSERVER
## ---------------------------------------------------
web_server:
port: 80
version: 2
js_url: !secret webserver_jsurl
## ---------------------------------------------------
## SNTP Time server
## ---------------------------------------------------
time:
- platform: sntp
id: time_sntp
timezone: Europe/Berlin
servers:
- 0.at.pool.ntp.org
- 0.pool.ntp.org
- 1.pool.ntp.org
on_time_sync:
then:
- logger.log:
level: WARN
tag: "system"
format: "Synchronized sntp clock"
# reset hourly value
on_time:
- seconds: 0
minutes: 0
then:
- globals.set:
id: hour_value
value: "0.00"
- lambda: id(waterhour).publish_state(id(hour_value));
- logger.log:
tag: "system"
level: INFO
format: "Reset value hour, starting next hour"
# reset daily value and set yesterday value
- seconds: 0
minutes: 0
hours: 0
then:
- lambda: id(yesterday_value)=id(daily_value);
- lambda: id(wateryesterday).publish_state(id(yesterday_value));
- lambda: id(daily_value)=0.00;
- lambda: id(waterday).publish_state(id(daily_value));
- logger.log:
tag: "system"
level: INFO
format: "Set yesterday value and reset value daily, starting new day"
# reset weekly value, start new week
- seconds: 0
minutes: 0
hours: 0
days_of_week: MON
then:
- globals.set:
id: week_value
value: "0.00"
- lambda: id(waterweek).publish_state(id(week_value));
- logger.log:
tag: "system"
level: INFO
format: "Reset value weekly, starting new week"
# reset monthly value and set last month value
- seconds: 0
minutes: 0
hours: 0
days_of_month: 1
then:
- globals.set:
id: month_value
value: "0.00"
- lambda: id(watermonth).publish_state(id(month_value));
- lambda: |-
if(id(waterdisplay).state){
id(lastmonth_value)=id(waterdisplay).state;
}
- logger.log:
tag: "system"
level: INFO
format: "Set value last monthly value, starting new month"
# new year, reset yearly value
- seconds: 0
minutes: 0
hours: 0
days_of_month: 1
months: JAN
then:
- globals.set:
id: year_value
value: "0.00"
- lambda: id(wateryear).publish_state(id(year_value));
- logger.log:
tag: "system"
level: INFO
format: "Reset value yearly, starting new year"
## ---------------------------------------------------
## SWITCHES
## ---------------------------------------------------
switch:
# reset boot counter value
- platform: template
name: Device Boot Counter Reset
turn_on_action:
then:
- lambda: |-
id(boot_counter) = 0;
id(bootcounter).publish_state(id(boot_counter));
- logger.log:
level: WARN
tag: "system"
format: "${device_name_short} reset boot counter o.k!"
- component.update: bootcounter
# reset all global vars
- platform: template
name: Watermeter Reset values
turn_on_action:
then:
- lambda: |-
id(last_value) = 0.00;
id(boot_counter) = 0;
id(bootcounter).publish_state(id(boot_counter));
id(current_value) = 0.00;
id(watercurrent).publish_state(id(current_value));
id(hour_value) = 0.00;
id(waterhour).publish_state(id(hour_value));
id(daily_value) = 0.00;
id(waterday).publish_state(id(daily_value));
id(yesterday_value) = 0.00;
id(wateryesterday).publish_state(id(yesterday_value));
id(week_value) = 0.00;
id(waterweek).publish_state(id(week_value));
id(month_value) = 0.00;
id(watermonth).publish_state(id(month_value));
id(lastmonth_value) = 0.00;
id(waterlastmonth).publish_state(id(lastmonth_value));
id(year_value) = 0.00;
id(wateryear).publish_state(id(year_value));
- logger.log:
level: INFO
tag: "system"
format: "all values reset!"
- platform: restart
name: "Device Restart"
id: restart_switch
## ---------------------------------------------------
## WMBUS DEVICE D1MINI WEMOS --> CC1101
## ---------------------------------------------------
##
## GDO0
## o
## 7
## | GD02 ╭-------o 2 (GND)
## | 6
## | o |
## | | |
## ╭――x――x――o――o――x――x――x――o――╮
## │ D1 D2 - │
## │ │
## │ D1MINI WEMOS │
## ANT │ │ USB
## │ │
## │ D5 D6 D7 D8 + │
## ╰――x――x――x――o――o――o――o――o――╯
## | | | | |
## | | | | ╰-----o 1 (+3.3V)
## | o | o
## | 5 | 8
## | MISO| CSN
## o o
## 4 3
## CLK MOSI
##
## ---------------------------------------------------
## TEXTSENSOR
## ---------------------------------------------------
text_sensor:
# shows teh current watermeter id from the telegram
# internal used only, not visible at web ui
- platform: custom
lambda: |-
auto textsensor = new MyTextSensor();
App.register_component(textsensor);
return {textsensor->my_text_sensor};
text_sensors:
- name: Wasserzähler
id: watermeter_id
internal: true
filters:
- to_upper:
on_value:
then:
- if:
condition:
lambda: "return (id(watermeter_id).state == id(mywatermeter_id));"
then:
- logger.log:
level: INFO
tag: "wmbus"
format: "✔︎ My Watermeter ID is: %s"
args: ["x.c_str()"]
else:
- logger.log:
level: INFO
tag: "wmbus"
format: "✘ Other Watermeter ID is: %s"
args: ["x.c_str()"]
# device version
# disabled for api (memory ??)
- platform: version
name: Application Version
internal: true
id: appver
entity_category: "diagnostic"
# device online time
- platform: template
name: Device Online seit
id: uptime_human
icon: mdi:clock-start
entity_category: "diagnostic"
# waterdisplay last update
- platform: template
name: Zählerstand aktualisiert
id: watermeter_lastupdate
icon: mdi:clock-start
entity_category: "diagnostic"
# device timestamp
# disabled for api (memory ??)
- platform: template
name: Device Timestamp
id: systime
internal: true
entity_category: "diagnostic"
lambda: return id(time_sntp).now().strftime("%Y-%m-%dT%H:%M:%S %Z");
# simple rest get message for all watermeter data
- platform: template
id: watermeterdata
internal: true
disabled_by_default: true
lambda: |-
char buf[128];
sprintf(buf, "%.3f|%.3f|%.3f|%.3f|%.3f|%.3f|%.3f|%.3f|%.3f|%s",
id(waterdisplay).state,
id(current_value),
id(hour_value),
id(daily_value),
id(yesterday_value),
id(week_value),
id(month_value),
id(lastmonth_value),
id(year_value),
id(systime).state.c_str()
);
std::string s = buf;
return s;
## ---------------------------------------------------
## SENSOR
## ---------------------------------------------------
sensor:
# get the current displayvalue from the telegram
# internal used only, not on api and web ui
- platform: custom
lambda: |-
auto sensor = new MySensor();
App.register_component(sensor);
return {sensor->my_sensor};
sensors:
- name: Wasserzähler gesamt
id: waterdisplay
unit_of_measurement: L
accuracy_decimals: 0
internal: true
on_value:
then:
- if:
condition:
lambda: "return (id(watermeter_id).state == id(mywatermeter_id));"
then:
- logger.log:
level: INFO
tag: "wmbus"
format: "✔︎ My Watermeter ID: %s and has value %.1f Liter"
args: ["id(watermeter_id).state.c_str()", "x"]
- lambda: |-
if(id(waterdisplay).state > 0.00){
id(watermeter_display_m3) = x * 0.001;
id(watermeterdisplay).publish_state(id(watermeter_display_m3));
}
if ((id(last_value) > 0.00) and (id(waterdisplay).state)>(id(last_value)) ) {
id(current_value) = (id(waterdisplay).state-id(last_value));
id(hour_value)+=id(current_value);
id(daily_value)+=id(current_value);
id(week_value)+=id(current_value);
id(month_value)+=id(current_value);
id(year_value)+=id(current_value);
ESP_LOGD("wmbus", "Set current value to %f litre and publish the data", id(watercurrent));
id(last_value)=id(waterdisplay).state;
}else{
id(current_value) = 0.00;
id(watercurrent).publish_state(id(current_value));
ESP_LOGI("wmbus", "Reset current value to: %.1f", id(watercurrent));
};
# update the timestamp for the last waterdisplay state
- text_sensor.template.publish:
id: watermeter_lastupdate
state: !lambda return id(time_sntp).now().strftime("%Y-%m-%dT%H:%M:%S %Z");
- logger.log:
level: INFO
tag: "wmbus"
format: "New Values: current:%.1f, hour: %.1f, day: %.1f, week: %.1f, month: %.1f, lastmonth: %.1f, year: %.1f"
args:
[
"id(current_value)",
"id(hour_value)",
"id(daily_value)",
"id(week_value)",
"id(month_value)",
"id(lastmonth_value)",
"id(year_value)",
]
else:
- logger.log:
level: INFO
tag: "wmbus"
format: "✘ Other Watermeter ID: %s and has value %.1f Liter"
args: ["id(watermeter_id).state.c_str()", "x"]
- platform: template
name: Wasserzähler Anzeige
id: "watermeterdisplay"
unit_of_measurement: "m³"
state_class: total_increasing
device_class: "water"
accuracy_decimals: 3
lambda: return (id(watermeter_display_m3) );
# water current
- platform: template
name: Wasser Aktuell
id: "watercurrent"
accuracy_decimals: 2
unit_of_measurement: "L"
state_class: "measurement"
device_class: "water"
lambda: return (id(current_value));
# water current hour
- platform: template
name: Wasser Stunde
id: "waterhour"
accuracy_decimals: 2
unit_of_measurement: "L"
state_class: total_increasing
device_class: "water"
lambda: return (id(hour_value));
# water today
- platform: template
name: Wasser Tag
id: "waterday"
accuracy_decimals: 2
unit_of_measurement: "L"
device_class: "water"
state_class: total_increasing
lambda: return (id(daily_value));
# water yesterday
- platform: template
name: Wasser Gestern
id: "wateryesterday"
accuracy_decimals: 2
unit_of_measurement: "L"
device_class: "water"
state_class: total_increasing
lambda: return (id(yesterday_value));
# water current week
- platform: template
name: Wasser Woche
id: "waterweek"
accuracy_decimals: 2
unit_of_measurement: "L"
device_class: "water"
state_class: total_increasing
lambda: return (id(week_value));
# water current month
- platform: template
name: Wasser Monat
id: "watermonth"
accuracy_decimals: 2
unit_of_measurement: "L"
state_class: total_increasing
device_class: "water"
lambda: return (id(month_value));
# water current year
- platform: template
name: Wasser Jahr
id: "wateryear"
accuracy_decimals: 2
unit_of_measurement: "L"
state_class: total_increasing
device_class: "water"
lambda: return (id(year_value));
# water last month
- platform: template
name: Wasser letzer Monat
id: "waterlastmonth"
accuracy_decimals: 2
unit_of_measurement: "L"
state_class: "measurement"
device_class: "water"
lambda: return (id(lastmonth_value));
# device uptime human reading format
# internal used only, not on api and web ui
- platform: uptime
name: Device Uptime
id: uptime_sensor
internal: true
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
# Wifi quality RSSI
# internal used only, not on api and web ui
- platform: wifi_signal
name: Device Wlan Signal
id: wifi_signal_db
update_interval: 60s
internal: true
entity_category: "diagnostic"
# Wifi quality RSSI in percentage
# Reports the WiFi signal strength in %
- platform: copy
source_id: wifi_signal_db
name: "Device Wlan Qualität"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
# Last boot timestamp
- platform: template
name: "Device Last Boot"
disabled_by_default: true
id: device_lastBoot_time
icon: mdi:clock-start
# device boot counter
- platform: template
name: Device Boot counter
id: bootcounter
accuracy_decimals: 0
entity_category: "diagnostic"
lambda: return (id(boot_counter));