Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: use now() or

See original GitHub issue

Nice trick, this sensor.

I was just wondering. Wouldn’t using now() be evaluating every minute, and using the entity be evaluating just once a day?

Another value_template could be:

value_template: >
  {% set w = strptime(states(''), '%Y-%m-%d').strftime('%w') | int %}

Not as clean but less resource consuming.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

BeardedTinkercommented, Apr 7, 2021

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() vs I will be implementing your suggestion for using

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.

stale[bot]commented, May 8, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found