danieldotnl / ha-measureit Goto Github PK
View Code? Open in Web Editor NEWMeasure anything in Home Assistant based on time and conditions.
License: MIT License
Measure anything in Home Assistant based on time and conditions.
License: MIT License
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.devcontainer.json
mcr.microsoft.com/vscode/devcontainers/python 3.12-bullseye
ghcr.io/devcontainers/features/rust 1
.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
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
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?
n/a
n/a
n/a
no problem - just a new feature
A service that would increase a MeasureIt counter
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.
And it's not only my coffee machine ;) I use a similar approach for my dish washer, my dryer, ...
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.
Add a service like the utility_meter has to calibrate the counter sensors, or consider extending the reset service with a value field.
Add the start value in the config flow. However, this does not enable one to update the value later on.
Irrelevant
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
...
.
No response
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.
Support source entities with state_class TOTAL_INCREASING and keep on measuring when the source resets to 0.
I guess this is not needed haha
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.
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'
No response
Once you created a config with sensors, it might be hard to remember after some time, which source sensor it is based on.
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.
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.
n/a
n/a
n/a
All predefined periods (except hourly) are currently resetting at 12 midnight. E.g.: it is not possible to reset a daily period at 6PM.
Support cron expressions for user to configure a custom period
Not really relevant here
After creating a new sensor
If I wish to edit the reset period, it's not really possible because no other options are available.
I don't think this is relevant but let me know if you'd like me to add logs.
No response
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 |
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 |
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 | 1 |
---|---|
resources | 8 |
views | 14 |
mode | storage |
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 |
version | 3.5.4 (a4a8c5f) |
---|---|
cloud_online | 5 / 5 |
local_online | 5 / 5 |
api_endpoint_reachable | ok |
---|
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.
America/Sao_Paulo
).No logs
No response
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 |
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 |
can_reach_server | ok |
---|---|
requests_remaining | 55 |
requests_per_day | 100 |
logged_in | false |
---|---|
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
dashboards | 4 |
---|---|
resources | 28 |
views | 34 |
mode | storage |
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 |
version | 3.5.4 (a4a8c5f) |
---|---|
cloud_online | 1 / 1 |
local_online | 0 / 0 |
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
create sensor with above parameters
# Could not update meters because the input value is invalid. Error: could not convert string to float: 'playing'
No response
The next reset time is one hour off (depending on the shift in time) if DST happens in that period.
This is an issue with the croniter dependency.
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).
Assistance on how to perform the above, plus more examples on how to use the various options you have provided.
tried every setting
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.
Please add another checkbox on the add sensors configuration page that allows to create a non-resetting sensor.
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.
Core 2023.12.4
Supervisor 2023.12.0
Operating System 11.2
Interfejs użytkownika 20231208.2
When selecting the unit of measurement "h", it counts hours incorrectly.
Manually (not using ha-measureit) works fine:
Time meter.
Template: {{is_state('binary_sensor.sm_g991b', 'off')}}
n/a
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.