Human readable Uptime (#986)

* Human readable Uptime

* Uptime from Frenck code

* Uptime with Frenck code

* Updated Human Readable Uptime

* Removed trailing spaces

* Renamed sensor to "Last started"

Sensor renamed
Update moved to the boot process
Clean-up

---------

Co-authored-by: Edward Firmo <94725493+edwardtfn@users.noreply.github.com>
Co-authored-by: Edward Firmo <edward@costafirmo.com>
This commit is contained in:
w00zy
2023-08-21 14:32:29 +01:00
committed by GitHub
parent d8e181fdda
commit be9b189a61
2 changed files with 18 additions and 6 deletions

View File

@@ -823,10 +823,15 @@ binary_sensor:
##### START - SENSOR CONFIGURATION #####
sensor:
##### Uptime #####
- name: ${device_name} uptime
platform: uptime
disabled_by_default: true
##### Uptime Template #####
- name: ${device_name} Last started
id: last_started
platform: template
internal: false
device_class: timestamp
entity_category: diagnostic
accuracy_decimals: 0
update_interval: never
##### WIFI Signal stregth
- name: ${device_name} RSSI
@@ -1311,6 +1316,9 @@ display:
- lambda: id(disp1).set_component_text_printf("boot.esph_version", "%s", "${version}"); ### esphome-version ###
- wait_until:
api.connected
- sensor.template.publish:
id: last_started
state: !lambda 'return id(time_provider).utcnow().timestamp;'
- lambda: id(disp1).set_component_text_printf("boot.ip_addr", "%s", id(ip_address).state.c_str());
- delay: 1s
- number.set: