Comments (9)
Can you tell me what to enter in the "Value template"?
I don't know how to react to the result.
Can you give an example?
Thanks
from ha-measureit.
But did you also set the value template to divide the value by 3600?
from ha-measureit.
{{ (states('sensor.my,sensor_day') | float / 3600) | round(2) }}
from ha-measureit.
Still counts in seconds...
Below is the recording.
I used templates:
{{ is_state('switch.kitchen_light_left', 'on') }}
{{ (states('sensor.my,sensor_day') | float / 3600) | round(2) }}
and units: h
Ps. When do I use "sensor.my,sensor_day" ? Always? This is independent of the name of the sensor and periods to measure?
ScreenRecorderProject1.mp4
from ha-measureit.
Sorry, you are right. I just copied the reply from the forum without testing.
Couple of remarks:
- the right value_template should be something like
{{ value | float / 3600 }}
. It should not get the state from the states function as this contains the previous value of the sensor. - Even with the right template, it might not do what you expect, and because this is the behaviour when assigning the device_class 'duration'. Device classes influence how the frontend displays data. And I think it does a nice job when you just keep it in seconds. When the value is low, it displays seconds or minutes and when higher, it changes into hours.
- If you really want a specific format, I think you should create a new config without the device_class (I just found a bug that updating the device_class in the options menu doesn't work). You can then do something like mentioned in this thread.
Hope this helps!!
from ha-measureit.
Hi, can u pls enter here how can i change measuring from seconds to hours ? im total programming noob, so i would appreciate to have a code for that. thanks
from ha-measureit.
It doesn't work in the current version. I'm working on a new one.
When measuring in hours, what format would you expect/what would the sensor state look like?
from ha-measureit.
24h format, so for example 14:37h ;-) thanks
from ha-measureit.
Please upgrade to v0.5.4 and read the rewritten README about formatting time sensors.
from ha-measureit.
Related Issues (20)
- Dependency Dashboard HOT 1
- Reset with service HOT 6
- Show source_sensor in sensor properties HOT 1
- Retain or not option for sensor HOT 8
- More examples would be good - eg how to count planes per day as per your intro HOT 10
- Add a non-resetting sensor HOT 2
- Daily Reset Using UTC Instead of Local Time HOT 14
- I just can't get it to work HOT 2
- Issue with updating meters HOT 1
- "Unknown error" when the user forgot to select a period from the list :joy: HOT 1
- Can't edit a sensor configuration HOT 1
- Next reset is one hour off when DST happens in period
- Support cron expressions for custom periods HOT 1
- Support for 'resetting source entities' with state_class TOTAL_INCREASING
- The integration needs to be adapted to changes in event filter signature
- Set or update value for counter HOT 2
- Add a Service: Increment Counter HOT 2
- Add Services: Start and Stop Timer
- Time tracking gives me incorrect values HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ha-measureit.