Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GrowSmart - ESPHome
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Grewe
GrowSmart - ESPHome
Commits
b547cbe1
Commit
b547cbe1
authored
2 months ago
by
Jan Grewe
Browse files
Options
Downloads
Patches
Plain Diff
use new built-in uptime sensor
parent
d3924905
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#1272
failed
2 months ago
Stage: validate
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/base.yaml
+1
-22
1 addition, 22 deletions
packages/base.yaml
with
1 addition
and
22 deletions
packages/base.yaml
+
1
−
22
View file @
b547cbe1
...
...
@@ -91,30 +91,9 @@ text_sensor:
reset_reason
:
name
:
"
Device:
Reset
Reason"
-
platform
:
templat
e
-
platform
:
uptim
e
id
:
device_uptime
name
:
"
Device:
Uptime"
update_interval
:
15s
lambda
:
|-
uint32_t dur = id(device_uptime_seconds).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[38];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
button
:
-
platform
:
restart
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment