Question: use now() or sensor.date
See original GitHub issueNice trick, this sensor.
I was just wondering. Wouldn’t using now()
be evaluating every minute, and using the sensor.date
entity be evaluating just once a day?
Another value_template could be:
value_template: >
{% set w = strptime(states('sensor.date'), '%Y-%m-%d').strftime('%w') | int %}
{{['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][w]}}
Not as clean but less resource consuming.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Date formatting - Configuration - Home Assistant Community
I tried something like {{now (). Day () + 'de' + months [now (). ... sensors and consider adding relevant `entity_id` entries or...
Read more >Optimise SQL Query- sensor readings - Stack Overflow
SELECT sensorid, MAX(value) AS maxvalue, MIN(value) AS minvalue FROM readings WHERE date >= NOW() - INTERVAL 24 HOUR GROUP BY sensorid.
Read more >24 Working with dates and times - Stata
You begin with the datetime variables in your data however they are recorded, such as 21nov2006 or 11/21/2006 or November 21, 2006, or...
Read more >Sensors | Instructions for Authors - MDPI
When preparing manuscripts in LaTeX, we encourage you to use the Sensors LaTeX template files. You can now also use the online application...
Read more >MATLAB Answers - MATLAB Central - MathWorks
Ask and find the best answers about MATLAB and Simulink. MATLAB Central gives you support and solutions from over 100000 community members and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for this - obviously hiccup from my side - I did write a very long response, but probably never hit submit/comment button 😃
Yes, you are correct about
now()
vssensor.date
I will be implementing your suggestion for using sensor.date.At one point I had a good reason to keep it like this, but that is now gone 😃
I should probably go through all of the code and track other time/date usage in there.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.