Giter Site home page Giter Site logo

ha-measureit's People

Contributors

danieldotnl avatar dependabot[bot] avatar igorsantos07 avatar kylehakala avatar misa1515 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ha-measureit's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

devcontainer
.devcontainer.json
  • mcr.microsoft.com/vscode/devcontainers/python 3.12-bullseye
  • ghcr.io/devcontainers/features/rust 1
github-actions
.github/workflows/lint.yml
  • actions/checkout v4
  • actions/setup-python v5
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v6
.github/workflows/release.yml
  • actions/checkout v4
  • softprops/action-gh-release v2.0.4
.github/workflows/tests.yml
  • szenius/set-timezone v2.0
  • actions/checkout v4
  • actions/setup-python v5
.github/workflows/validate.yml
  • actions/checkout v4
  • actions/checkout v4
pip_requirements
requirements.txt
  • colorlog ==6.8.2
  • pip >=24,<25
  • ruff ==0.4.3
  • pytest-homeassistant-custom-component ==0.13.122
  • croniter ==2.0.5
  • isort ==5.13.2

  • Check this box to trigger a request for Renovate to run again on this repository

Reset with service

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

Now there is predetermined intervals for the sensor to reset like days, month, year. But can there be an option where there is no prefixed interval but a service to reset the sensors?

Describe the solution you'd like

n/a

Describe alternatives you've considered

n/a

Additional context

n/a

Add a Service: Increment Counter

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

no problem - just a new feature

Describe the solution you'd like

A service that would increase a MeasureIt counter

Describe alternatives you've considered

At the moment a counter is increased when a status change happens. Which works!!

But in some cases I only have an automation that detects something countable, e.g. the power consumption of my coffee machine drops below a specified value, and that means one more cup of coffee has been brewed.
Currently, the automation turns an input_boolean to on, waits for 5 seconds, and turns it off again. and MeasureIt counts the status change.

Additional context

And it's not only my coffee machine ;) I use a similar approach for my dish washer, my dryer, ...

Set or update value for counter

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

For example: I want to count how many cups of coffee I brew with my coffee machine, so I know when it needs maintenance. However, the MeasureIt counter starts at 0 while I know I had already 200 cups of coffee. I want the MeasureIt counter to start at this value.
I should also be able to update the counter if Home Assistant was down and missed some cups.

Describe the solution you'd like

Add a service like the utility_meter has to calibrate the counter sensors, or consider extending the reset service with a value field.

Describe alternatives you've considered

Add the start value in the config flow. However, this does not enable one to update the value later on.

Additional context

https://community.home-assistant.io/t/measureit-measure-all-you-need-based-on-time-and-templates/660614/26?u=danieldotnl

The integration needs to be adapted to changes in event filter signature

System Health details

Irrelevant

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

The integration needs to be adapted to changes in event filter signature

Background in home-assistant/core#113798

Example change: andrew-codechimp/HA-Battery-Notes#1337

Reproduction steps

...

Debug logs

.

Diagnostics dump

No response

Support for 'resetting source entities' with state_class TOTAL_INCREASING

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

It is currently not possible to measure a total value for a week from a source entity that resets daily. E.g. I want to measure the precipitation in a week based on a precipitation sensor that resets daily to 0.

Describe the solution you'd like

Support source entities with state_class TOTAL_INCREASING and keep on measuring when the source resets to 0.

Describe alternatives you've considered

Additional context

"Unknown error" when the user forgot to select a period from the list :joy:

System Health details

I guess this is not needed haha

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

This is quite straightforward: since I think it's not possible to mark those list of options as required, I guess you could try..except when someone like me skips the period option 😂

Currently it just says "unknown error" and I had to dig through logs to see how stupid I am, going through a lot of levels of... HTTP stuff? It's a tad confusing.

Reproduction steps

  1. Fill it all as expected, except for the periods option
  2. submit
  3. get lost

image

Debug logs

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 19:03:58 (1 occurrences)
Last logged: 19:03:58

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 416, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 347, in _async_step
    result = await self._common_handler.async_step(step_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 132, in async_step
    return await self._async_form_step(step_id, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 168, in _async_form_step
    user_input = await form_step.validate_user_input(self, user_input)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/measureit/config_flow.py", line 98, in validate_sensor_setup
    for period in user_input[CONF_PERIODS]:
                  ~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'periods'

Diagnostics dump

No response

I just can't get it to work

I've been trying, but I just can't get it to work.

I have 2 binary sensors:

binary_sensor.125_1st_fl_heat_graph_binary
binary_sensor.125_2nd_fl_heat_graph_binary

And I would like to maintain a daily total of the number of minutes when either state is ON.

I admit I don't even understand if I should choose TIME or SENSOR for that which I want to measure. I tried both.

I don't understand when to use a condition template vs. a value template.

I understand that there is a lot I don't understand, but I had high hopes this integration would make it easy enough for a total non-programmer to make work.

Any help would be appreciated.

Thank you.

Retain or not option for sensor

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

Can there be an another option to select either to retain the sensor value or reset after reboot of HA?

I want to collect the number of times a sensor has changed from the time HA rebooted while I also have to continue the count of state changes even after reboot till the reset condition comes.

Describe the solution you'd like

n/a

Describe alternatives you've considered

n/a

Additional context

n/a

Support cron expressions for custom periods

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

All predefined periods (except hourly) are currently resetting at 12 midnight. E.g.: it is not possible to reset a daily period at 6PM.

Describe the solution you'd like

Support cron expressions for user to configure a custom period

Describe alternatives you've considered

Additional context

Can't edit a sensor configuration

System Health details

Not really relevant here

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

After creating a new sensor
If I wish to edit the reset period, it's not really possible because no other options are available.

Reproduction steps

  1. Create a new source sensor
  2. Choose any time you wish
  3. Choose period = forever
  4. Complete the process
  5. Click configure on the new sensor you're created
  6. Choose "Edit a Sensor Configuration"
    Expected Result:
    All of the period options are available for selection
    Actual Result:
    Only "forever" is available for selection

image

Debug logs

I don't think this is relevant but let me know if you'd like me to add logs.

Diagnostics dump

No response

Daily Reset Using UTC Instead of Local Time

System Health details

System Information

version core-2024.1.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.71-haos
arch x86_64
timezone America/Sao_Paulo
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4996
Installed Version 1.33.0
Stage running
Available Repositories 1380
Downloaded Repositories 24
Home Assistant Supervisor
host_os Home Assistant OS 11.4
update_channel stable
supervisor_version supervisor-2023.12.1
agent_version 1.6.0
docker_version 24.0.7
disk_total 30.8 GB
disk_used 22.2 GB
healthy true
supported true
board ova
supervisor_api ok
version_api failed to load: timeout
installed_addons Samba share (12.2.0), Terminal & SSH (9.8.1), Node-RED (17.0.2), InfluxDB (5.0.0), Home Assistant Google Drive Backup (0.112.1), Mosquitto broker (6.4.0), Zigbee2MQTT (1.35.1-1), JupyterLab (0.13.0), ESPHome (2023.12.6), Studio Code Server (5.15.0)
Dashboards
dashboards 1
resources 8
views 14
mode storage
Recorder
oldest_recorder_run January 6, 2024 at 6:13 PM
current_recorder_run January 15, 2024 at 3:17 PM
estimated_db_size 992.92 MiB
database_engine sqlite
database_version 3.41.2
Sonoff
version 3.5.4 (a4a8c5f)
cloud_online 5 / 5
local_online 5 / 5
Spotify
api_endpoint_reachable ok

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

I've noticed that the script resets based on UTC time rather than the local time configured in Home Assistant. This leads to inaccurate daily measurements for users in different time zones. It would be more appropriate if the script could reset according to the local time settings of Home Assistant to ensure accurate daily tracking.

Reproduction steps

  1. Set your Home Assistant time zone to a non-UTC zone (e.g., America/Sao_Paulo).
  2. Configure a measurement item with the following settings: From Time: 12:00:00 AM, Till Time: 12:00:00 AM.
  3. Observe that the measurement resets at 9 PM instead of midnight, indicating that the reset is occurring based on UTC time rather than the local time set in Home Assistant.

Notice Next reset is 9PM
image

Debug logs

No logs

Diagnostics dump

No response

Issue with updating meters

System Health details

System Information

version core-2024.1.5
installation_type Home Assistant Container
dev false
hassio false
docker true
user albatros
virtualenv false
python_version 3.11.6
os_name Linux
os_version 5.15.0-91-generic
arch x86_64
timezone Europe/Warsaw
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4994
Installed Version 1.34.0
Stage running
Available Repositories 1454
Downloaded Repositories 48
HACS Data ok
Airly
can_reach_server ok
requests_remaining 55
requests_per_day 100
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Dashboards
dashboards 4
resources 28
views 34
mode storage
Recorder
oldest_recorder_run 20 stycznia 2024 11:30
current_recorder_run 29 stycznia 2024 11:12
estimated_db_size 1343.53 MiB
database_engine mysql
database_version 8.0.32
Sonoff
version 3.5.4 (a4a8c5f)
cloud_online 1 / 1
local_online 0 / 0

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Create Netflix wathing counter
Added new sensor - > Source sensor -> Media player entity

Condition template - > {{ is_state_attr('media_player.smart_tv_pro_2', 'app_name', 'Netflix') }}

Sensor - > duration, total increasing

Sensors are not updating, error as in debug

Reproduction steps

create sensor with above parameters

Debug logs

# Could not update meters because the input value is invalid. Error: could not convert string to float: 'playing'

Diagnostics dump

No response

More examples would be good - eg how to count planes per day as per your intro

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

It would be great if there were some examples on how to use it.
I cant seem to get the FlightRadar plane counting example you propose to work. I have tried state class of: measure, total, total increasing, but all i end up with is a value of Zero, or briefly the number of planes (as the input being flights entered zone is typically zero, with periodic pulses of 1,2 etc).

Describe the solution you'd like

Assistance on how to perform the above, plus more examples on how to use the various options you have provided.

Describe alternatives you've considered

tried every setting

Additional context

image
image
image

Add a non-resetting sensor

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

I like my statistics to be non-resetting or ever-increasing, so I can always query the statistic value for any randomly selected period by simply subtracting the start value from the end value, giving the change over the period. I often use the energy date range picker card this.

Describe the solution you'd like

Please add another checkbox on the add sensors configuration page that allows to create a non-resetting sensor.

Describe alternatives you've considered

I currently selected a yearly-resetting sensor as this is the longest period I could select, but this means that when selecting a period that includes a year change, the end value will be less than the start value, resulting in a negative change value for that period.

Additional context

image

Incorrect count for: "unit_of_measurement: h"

System Health details

Core 2023.12.4
Supervisor 2023.12.0
Operating System 11.2
Interfejs użytkownika 20231208.2

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

When selecting the unit of measurement "h", it counts hours incorrectly.

image

image

Manually (not using ha-measureit) works fine:

image

image

Reproduction steps

Time meter.
Template: {{is_state('binary_sensor.sm_g991b', 'off')}}

Debug logs

n/a

Diagnostics dump

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.