Home Assistant How To - get more Statistics from sensors

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • Getting more statistics from your existing sensors and binary sensors is very easy with Home Assistant built-in component - Statistics. It can help you learn more about your home and area where you live from the data you already have.
    www.home-assistant.io/integra...
    00:00 Intro
    00:19 Thank you to Channel members
    00:33 About statistics component
    01:44 Add statistics to sensor.yaml file
    06:40 Restart Home Assistant for changes to take effect
    08:23 Rename your statistics sensors
    09:15 Looking at statistics
    11:17 Wrap-up
    Here is sample sensor.yaml code
    Synology CPU sensor stats for last 60 minutes
    - platform: statistics
    entity_id: sensor.synology_cpu_load_total
    max_age:
    minutes: 60
    name: Synology CPU stats
    ISS binary sensor counter
    - platform: statistics
    entity_id: binary_sensor.iss
    name: ISS counter stats
    Outside temperature stats with 2 decimal spaces
    - platform: statistics
    entity_id: sensor.weather_temperature
    precision: 2
    name: Temperature stats
    eCO2 stats with 2 decimal spaces and last 20 samples
    - platform: statistics
    entity_id: sensor.ccs811_eco2_value
    sampling_size: 20
    precision: 2
    name: eCO2 stats
    Don't forget to check your configuration and restart Home Assistant after you finish all of the editing.
    Please, give me a thumb up if you liked this video, subscribe if you still haven't and I'll see you next time!
    Have fun!
    BeardedTinker
    P.S. If you would like to support me and this channel, you can now JOIN and become member!
    ruclips.net/user/BeardedTinker...
    Twitter: @BeardedTinker
    Discord: / discord
    #howto #HomeAssistant #thershold
  • НаукаНаука

Комментарии • 42

  • @ansomeBob
    @ansomeBob 4 года назад +1

    Wonderful, I shall have fun with this. Thanks for another very useful video.

    • @BeardedTinker
      @BeardedTinker  4 года назад

      Thank you Bob! I really love to explore Home Assistant integrations and ways to use them👍

  • @MrAlessandrodamato
    @MrAlessandrodamato 2 года назад +1

    dear BeardedThinker, this guide is just GREAT! Thanks for uploading it

  • @VHAWildeman
    @VHAWildeman 11 месяцев назад +1

    This video was crucial in finding a solution to extract energy for the last 24 hours. Thank you!
    - platform: statistics
    name: "Energie Diepvries laatste 24 uur"
    entity_id: sensor.diepvries_ts_energy
    state_characteristic: 'change'
    max_age:
    hours: 24
    precision: 2

    • @BeardedTinker
      @BeardedTinker  11 месяцев назад

      Glad it helped!!! Thanks for comment!

  • @DjLundbladh
    @DjLundbladh 4 года назад +1

    Great! following this guide right now =)

    • @BeardedTinker
      @BeardedTinker  4 года назад

      Don't forget to leave everything running for a bit until you get more data on sensors.

  • @arnoldbencz6886
    @arnoldbencz6886 3 года назад +1

    Super! Thank You Sir 👍

  • @CarlosRuiz-nx3vm
    @CarlosRuiz-nx3vm 4 года назад +1

    Great video, thanks.

  • @Mr_ToR
    @Mr_ToR 2 года назад +1

    There was a typo for the temperature, you entered entitiy instead of entity and I was wondering how it was working with the typo and then you showed the yaml again and apparently you fixed it :-)
    Nice video.

    • @BeardedTinker
      @BeardedTinker  2 года назад

      Thank Tonguç Endem - little bit of video editing :)
      I make a lot of typos due to "fast" typing, but sometimes forget to edit part out in the video where there was an error.

  • @eduardojahnke8970
    @eduardojahnke8970 3 года назад +1

    Nice feature I didn't knew about! How would you make a card using those values? For example, a card showing min and max daily temperature of a room.

    • @BeardedTinker
      @BeardedTinker  3 года назад +2

      For that, I use HACS frontend card - mini graph card and this is what I have in UI:
      entities:
      - sensor.min_temp_rooms
      - sensor.max_temp_rooms
      name: Minimum/Maximum
      show:
      fill: false
      labels: true
      type: 'custom:mini-graph-card'

  • @Mezhona
    @Mezhona 4 года назад +1

    Hi BearededTinker, I was wondering if you would do an video about Smartthings integration with Home Assistant? I'm having issues configuring the integration, it wont accept my Personal Access Token from the Samsung Smartthings.

    • @BeardedTinker
      @BeardedTinker  4 года назад

      I don't have SmartThings or use it so can't test it except to just create account.
      But from what I've read around - couple of questions. Do you have external access to Home Assistant (valid public domain and SSL certificate).
      Also, do you have in your configuration.yaml
      webhook:
      enabled?

  • @webcompanion
    @webcompanion 2 года назад +1

    I see that when you click on a stats value on your front end it opens a window and you see a wide variety of statistics like min, max, mean, etc... however this was back in July 2020 when you made this video and I don't see Home Assistant working like this today (late Feb 2022). I only see the mean value and when I click on the value in my front end, I get a graph that pops up. Not a complaint, not looking for a solution -- just wanted to post an observation. Thanks for this video! I learned from it!

    • @BeardedTinker
      @BeardedTinker  2 года назад +1

      Thanks for the comment John! Yes, a lot of things have changes in past -12 years - for example now it had one field that will become mandatory soon - state_characteristic: . But I think, in terms of data, Statistics integration is still providing same.
      www.home-assistant.io/integrations/statistics/
      Biggest difference is that HA now has recorded for long term statistics that already does some data transformation to keep data available for longer period of times.
      It's hard to keep all of the content up-to-date, as depending on the development there can be a lot of changes. Thanks again for your comment!

  • @timtaler8439
    @timtaler8439 3 года назад +1

    Greetings, and thank you for the video.
    Sadly, I still don't get it. I've created a statistics sensor like shown in your videos (based on an Aqara temperature sensor) and this new sensor shows me like 17 attributes. Besides the fact that I still don't understand all of the displayed attributes, I would like to see those values in the UI. When I use those mini graph cards, it only displays a single value, the mean value. Basically, I'm interested in also seeing the other values in some cards as well. I know, that there are also other sensors (like history, min_max), but does it make sense to create new entities. It's already in this sensor, or? Thanks a lot, Tim

    • @BeardedTinker
      @BeardedTinker  3 года назад +1

      Thanks for the comment Tim!
      You can have a look here: community.home-assistant.io/t/show-sensor-attributes-in-lovelace-as-with-custom-ui-state-card/78470/2
      Each sensor has only one state, and everything else is attribute - and problem is that currently (if I'm not mistaken) there is no built-in way to present attributes or use them in a same way as you use state. Attributes can be used in template sensors and templates.

    • @timtaler8439
      @timtaler8439 3 года назад +1

      @@BeardedTinker Thanks for your reply.
      I've figured it out by now. It's just more manual typing than I expected, because I didn't see a reason, why the HA logic could not parse it directly. I was hoping for a more elegant solution, but using the templates works at least. So now it is understood and I need to watch your video concerning how to split the configuration files. It makes no sense to have everything in a single file, because you can easily mix things up in a constantly growing file. Thank you for your videos of HA on a Synology. Let's hope we'll figure out, how to use HA with DSM7 as soon as it is released.

    • @BeardedTinker
      @BeardedTinker  3 года назад +1

      @@timtaler8439 some decisions for designe I don't understand, as it requires a bit more work, but probably there is a good reason for it. Wish only I knew it - it would make understanding this a bit easier.
      Splitting configuration really helps in long term. Just wish there was official support for it (for ex. editing automations and other stuff) in UI. I know a lot of devs have it this way too. Hopefully, they will work on it.
      In regard to DSM 7, we will see - I follow few dev forums, to see how are the things working, but doesn't look easy for now.

  • @rasbe6863
    @rasbe6863 4 года назад +1

    thanks for another great video. Can you share your proxmox yaml. I have tried it myself but get an error with my yaml.

    • @BeardedTinker
      @BeardedTinker  4 года назад

      Sure thing - here it is:
      proxmoxve:
      - host: 192.168.1.30
      username: xyzxyz # change to username you created in proxmox
      password: xyzxyz # change to password for that user
      verify_ssl: false
      realm: pve
      nodes:
      - node: proxmox
      vms:
      - 201
      - 202
      You have to make sure you created new user with Audit rights and that it is created inside PVE realm.
      Also, you need to match vms: to name/number of your VM's

  • @mRendyIrawan
    @mRendyIrawan 4 года назад +1

    I have a Sonoff POW R2 and I was wondering if there is any way to have home assistant calculate the total wH usage? The examples I see you have provided here only count often used statistical data like mean, total, standard deviation, etc. and unfortunately the Sonoff doesn't come with its own wH entity.

    • @BeardedTinker
      @BeardedTinker  4 года назад

      You can try to get Wh with this integration: www.home-assistant.io/integrations/integration

    • @mRendyIrawan
      @mRendyIrawan 4 года назад +1

      BeardedTinker This is just what I needed! Thank you so much! Now I could have a utility meter set up along with power cost calculation.

  • @twistedaus
    @twistedaus 3 года назад +1

    1:29 How do you get values to display on the sensor graph?

    • @BeardedTinker
      @BeardedTinker  3 года назад

      This graph is custom component called mini-graph-card - available through HACS.

  • @groentoft
    @groentoft 3 года назад +1

    If I want to get the maximum value of a sensor and the value is from yesterday, how would you do that?

    • @BeardedTinker
      @BeardedTinker  3 года назад

      This is great question Per! Was trying to think of something else, but looks like one option I'm currently using could be "best". Mind you, this is not cleanest but works.
      I've created some additional input_number fields and then, 30 seconds before midnight, I store current value in them via automation. You do lose 30 seconds of data, but that's just to ensure that due to the lag you don't get empty values there. Instead of input_number, you can also create empty sensors and save value there too.
      For ex. if you have sensor.minimum_temp, you create also sensor.minimum_temp_yesterday then at 23:5930 daily trigger to and save sensor.minimum_temp_yesterday = sensor.minimum_temp
      I know it's not cleanest, but it works. And yes, you can even save attributes (I don't do that currently).

  • @Allard9240
    @Allard9240 4 года назад +1

    Hi how can i get the configuration tab on the left when i am using hass.io on synology?

    • @BeardedTinker
      @BeardedTinker  4 года назад

      File editor? That is add-on from hass.io - it was previously called configurator but is now called file editor. You can install it from add-on page. And to have it permanently visible, just click show on left pane.

    • @Allard9240
      @Allard9240 4 года назад +1

      @@BeardedTinker That's it, thanks a lot :)

    • @Allard9240
      @Allard9240 4 года назад +1

      @BeardedTinker can I use the same method of MQTT (mosquito) for Hass.io as i did for home assistant core?

    • @BeardedTinker
      @BeardedTinker  4 года назад

      Yes, you should be able to use same method. I have MQTT running in Docker and I'm using hass.io community package . I do not think I will move to MQTT as add-on.
      Hope that this helps.

  • @sedativejam
    @sedativejam 2 года назад +1

    Can you specify the time of day to track the statistics?

    • @BeardedTinker
      @BeardedTinker  2 года назад

      So you only track statistics in specific time of the day? As far as I know, no, you can't do that. For more detailed statistics etc, you would need to use for example InfluxDB and Grafana that both are allowing you to store data for longer time but also give you ability to create custom queries and graphs.

  • @enormousearl8838
    @enormousearl8838 2 года назад +1

    Tried this for my wifi download speed sensor and it didn't work. Still doesn't show up in the dashboard as a compatible entity for statistics.