Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept
I would like to change the background color on the row containing the price for the current hour.
When hardcoding the hour into the css selector, it works just fine, but when trying to use the current hour, it doesn't work.
How do I make it use a variable?
This work:
css: 'tbody tr:nth-child(18}) td': 'background-color: blue'
This doesn't work:
css: 'tbody tr:nth-child({{ new Date().getHours() }}) td': 'background-color: blue'
or
css: 'tbody tr:nth-child({% new Date().getHours() %}) td': 'background-color: blue'
I have a table with energy prices for each hour.
Hour | Price 00-01 | 0.12 01-02 | 0.34 ...
I would like to change the background color on the row containing the price for the current hour.
When hardcoding the hour into the css selector, it works just fine, but when trying to use the current hour, it doesn't work. How do I make it use a variable?
This work:
css: 'tbody tr:nth-child(18}) td': 'background-color: blue'
This doesn't work:
css: 'tbody tr:nth-child({{ new Date().getHours() }}) td': 'background-color: blue'
orcss: 'tbody tr:nth-child({% new Date().getHours() %}) td': 'background-color: blue'