I tried last night to create a dynamic attribute name with the temperature as the value but it didn’t work.
Then I found a post here saying it can’t be done without python
So how can I save 24 hours of weather temperature?
I need to have this data easily accessible since I want to output it on a MAX7219 8 bit display, something like temperature now and temperature say 5 hours ago.
As far as I have managed to google it’s not easily accessible in the history database, so that is why I thought I could just save it in an entity.
Since this doesn’t work:
I’m using statistics (for electricity use tracking) and despite much fiddling, and reading documents, somehow I’ve managed to miss how I can get other stats out. A pointer would be appreciated.
they are attributes of the main sensor. Just take a look at the created sensor in the developer tools / states page. You’ll see that it has 10-15 attributes.
@petro@AhmadK Thanks guys. The magic (missed by me) word is attribute. Given that pointer, I took my existing entity_id and used value_template on it to find the mean. Not sure my solution is elegant but it works.
What is the statre of sensor.smhi_home? If you are trying to use an attribute as the source, you’ll have to make a template sensor for the attribute before feeding it to the statistics sensor.
Apologies to @Hellis81 for piggy-backing but we have similar issues.
@petro I made a sensor, especially for the mean, wrongly as it turns out, based on your comment that the mean is the main state, which I now see in Developer Tools/States. Still, my value_template workings will still be useful for adding max/min. Then I need to do some arithmetic, to get costs. Then sort max_age, sampling, icon…
This is the Home Assistant version of some Python scripts that I have had running for a few years. I’m a newbie to HA, so this is very much experimental, and enjoyable.
how can it work if a) your source entity is weather.hem (not weather.smhi_home that you use in the template) and b) your template is single-line so in must be enclosed in quotes?
did you check your config or reboot HA after making the changes?
also, I’m almost certain you don’t need that | float as the result will be converted to a string anyway, you just need to make sure the result is always a string that represents a float, i.e nothing like unknown.
You don’t need the float because i’ts already a float and you’re sending it out at that point. The unit of measurement determines that it’s a ‘number’ for your graphs.