-
Hello everyone, I thought I could use
Essentially the current time minus the sensors value should result in an uptime in seconds. Could anybody help me understand where I am going wrong? Thank you P.S.: In case David is reading this, I think the indentation on the lambda example is off. At least they were showing bad indentation when I tried to start with them as templates. Edit:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Try with: (ys) => ys.map(y => Date.now() - new Date(y)) You can check the js logs by opening the "dev console" in the browser. Makes easy to spot syntax errors and what not. By the way, https://esphome.io/components/sensor/uptime.html Thanks for noting the indentation error. I'll check it out soon. Can you point me to the exact example? |
Beta Was this translation helpful? Give feedback.
-
Solution: type: custom:plotly-graph
entities:
- entity: sensor.esp32_wroom_32d_devkitc_v4_1_last_restart_time
lambda: (ys) => ys.map((y => Date.now() - Date.parse(y))/1000)
unit_of_measurement: s |
Beta Was this translation helpful? Give feedback.
Solution: