lolouk44 / currentcost_ha_cc Goto Github PK
View Code? Open in Web Editor NEWCurrentCost Meter Reading Custom Component for Home Assistant
CurrentCost Meter Reading Custom Component for Home Assistant
In the days when Current Cost hosted a web service to upload the data collected using their equipment is was possible to display a meter reading for Gas & Elec (and water if you had one I think)
is it possible to extract some data then calibrate a figure to correspond with your physical meter reading.
name: Bug report
about: Create a report to help us improve
title: 'Values from IAM sensors get stuck and dont revert to 0 when power stops'
labels: bug
assignees: ''
Describe the bug
While the ENVIR operates correctly for whole of house sensor (but of course this never drops to 0), the 3 IAMs I am using maintain the last value stored in them rather than reverting back to 0 when power stops, they change correctly as demand rises and falls however it sometimes sticks at a value when the device (pool pump) stops, this means the log file continues too log the Watts the high value.
To Reproduce
This happens every day and requires a reboot to clear the 'stuck' value
Expected behaviour
I would expect the Watts value to revert back to 0 once it stopped receiving info for > 5s
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop/Server/Device (please complete the following information):
Raspberry Pi, 3b
HACS
Additional context
Add any other context about the problem here.
Logs
No errors appear in the logs - the Envir continues to work perfectly its only the IAM sensors that dont
Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant.
To Enable debug logging level, add this to your configuration.yaml and restart:
logger:
default: error
logs:
custom_components.currentcost: debug
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The 'entity_id' option near .homeassistant/configuration.yaml:63 is deprecated, please remove it from your configuration
Describe the solution you'd like
A clear and concise description of what you want to happen.
Probably some form of unique id before homeassistant breaks it.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
is it possible to use one of the entity id value templates to then create another sensor such as daily total, weekly total, rolling total etc.
Hi - Thanks for this. I've previously been capturing currentcost data with my own perl script, then injecting readings into a mariadb database, then using sql queries to get that into HA - quite the convoluted path, and your method is much nicer.
As quite a few people are using HA in docker, I thought it might be useful to add some documentation on doing this, so I've sketched it out below in the hope it's useful.
=====
Running HA in docker means it does not, by default, have access to USB ports. But they can be passed through.
If using docker-compose (recommended), add this to your docker-compose.yml file to pass through the port (Host -> Container)
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
If running docker alone: Use --device=/dev/ttyUSB0
on the docker run command line.
Sometimes the by-id path doesn't expand for me, and you may need to play around udevd rules to get a consistent path for thi,s especially if you're using more than one USB device on the host.
You can also use privileged mode in both forms to pass through all local devices, but this does have some security concerns.
Sorry was a false alarm although the last column is at 11pm there are 24 of them. please close / delete this
Hi,
did you consider adding this to HACS? That would make installation a lot easier. Guide for adding is available here https://hacs.xyz/docs/publish/start
Seems @jysaloma did start
https://github.com/jysaloma/CurrentCost_HA_CC
Thanks!
While using a Pi3 with Home Assistant 2021.6.3 there is no data for the temperature entry.
On the new HA complete image for a raspberry Pi (docker based) - the Pi cannot see the CurrentCost device. The line "serial_port: /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0" is used, as this is the what appears in /dev/serial on the pi.
There is a comment about using docker that implies this needs to change, or that some other HA config may be needed - but I am uncertain how.
Any advice on config and trouble shooting this would be gratefully recieved!
Regards Eadmund
Hiya,
Sorry not actually a Feature request / Issue.
I have a Current Cost display, but not the serial adapter.
Do you know what the type of cable is, so that I can try to find a compatible cable.
Thanks,
Describe the bug
This custom integration uses deprecated DEVICE_CLASS_*
constants in its codebase.
The DEVICE_CLASS_*
constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.
For example, for the device classes supported by the sensor
platform, there is now a SensorDeviceClass
enum. So if a sensor previously used the DEVICE_CLASS_ENERGY
constant, it should now use SensorDeviceClass.ENERGY
. Other platforms (like binary_sensor
, and number
) provide similar enumerations for their supported device classes.
The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.
If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!
Kindest regards,
../Frenck
To Reproduce
n/a
Expected behaviour
n/a
Screenshots
n/a
Desktop/Server/Device (please complete the following information):
Additional context
n/a
Logs
n/a
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
Describe the bug
For unknown reasons my currentcost usb-serial interface loses connection intermittently. In the process the script crashes and is dead/unresponsive until hass is restarted.
To Reproduce
Steps to reproduce the behaviour, including error message if any.
Expected behaviour
Gracefully handle any serial port failures and recover.
By adding a <try, except> over the reader.readline the scripts seems to recover properly. Probably have to add some delay or timeout in exception handling to prevent excessive logging.
while True:
try:
line = await reader.readline()
line = line.decode("utf-8").strip()
_LOGGER.debug("Line Received: %s", line)
except:
_LOGGER.error("Error reading from serial port")
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop/Server/Device (please complete the following information):
Additional context
Add any other context about the problem here.
Logs
Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant.
To Enable debug logging level, add this to your configuration.yaml and restart:
logger:
default: error
logs:
custom_components.currentcost: debug
2023-09-24 09:56:15.339 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.currentcost
2023-09-24 09:56:15.463 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform currentcost
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
entity.add_to_platform_start(
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 211, in add_to_platform_start
self._async_read_entity_options()
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 785, in _async_read_entity_options
registry.async_update_entity_options(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1025, in async_update_entity_options
old = self.entities[entity_id]
~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/local/lib/python3.11/collections/__init__.py", line 1126, in __getitem__
raise KeyError(key)
KeyError: None
2023-09-24 09:56:15.494 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up currentcost platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
entity.add_to_platform_start(
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 211, in add_to_platform_start
self._async_read_entity_options()
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 785, in _async_read_entity_options
registry.async_update_entity_options(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1025, in async_update_entity_options
old = self.entities[entity_id]
~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/local/lib/python3.11/collections/__init__.py", line 1126, in __getitem__
raise KeyError(key)
KeyError: None
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
Describe the bug
A clear and concise description of what the bug is.
Strangely this is working perfectly in the ui but every 6 seconds pretty much I get
2021-08-10 01:09:01 ERROR (MainThread) [custom_components.currentcost.sensor] Setting up State Class
To Reproduce
Steps to reproduce the behaviour, including error message if any.
install latest version
Expected behaviour
A clear and concise description of what you expected to happen.
no errors :)
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop/Server/Device (please complete the following information):
Additional context
Add any other context about the problem here.
2021-08-10 01:08:43 ERROR (MainThread) [custom_components.currentcost.sensor] Setting up State Class
2021-08-10 01:08:49 DEBUG (MainThread) [custom_components.currentcost.sensor] Line Received: CC128-v1.290201219:25:0919.7002016100305
2021-08-10 01:08:49 ERROR (MainThread) [custom_components.currentcost.sensor] Setting up State Class
2021-08-10 01:08:55 DEBUG (MainThread) [custom_components.currentcost.sensor] Line Received: CC128-v1.290201219:25:1519.6002016100310
2021-08-10 01:08:55 ERROR (MainThread) [custom_components.currentcost.sensor] Setting up State Class
2021-08-10 01:09:01 DEBUG (MainThread) [custom_components.currentcost.sensor] Line Received: CC128-v1.290201219:25:2119.6002016100307
Logs
Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant.
To Enable debug logging level, add this to your configuration.yaml and restart:
logger:
default: error
logs:
custom_components.currentcost: debug
sorry not good at this, i thought it might be the dehumidifier example but hashed out also of 0, 2, 9 removed 9
it seems to work mostly just the log entry after each read from the serial port.
name: Bug report
about: Create a report to help us improve
title: ''home assistant 2023.6.0 refuses to load currentcost component
labels: bug
assignees: ''
Describe the bug
After updating home assistant, currentcost module doesn't work any more
To Reproduce
Install currentcost under home assistant 2023.6.0, after adding platfform currentcost to configuration.yaml check configuration and the error will be generated
Desktop/Server/Device (please complete the following information):
Logs
This error originated from a custom integration.
Logger: homeassistant.loader
Source: custom_components/currentcost/sensor.py:7
Integration: currentcost (documentation, issues)
First occurred: 21:47:16 (1 occurrences)
Last logged: 21:47:16
Unexpected exception importing platform custom_components.currentcost.sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/currentcost/sensor.py", line 7, in
import serial_asyncio
File "/usr/local/lib/python3.11/site-packages/serial_asyncio/init.py", line 408, in
@asyncio.coroutine
^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
Describe the bug
2024-01-21 13:12:17.417 WARNING (MainThread) [homeassistant.const] POWER_WATT was used from currentcost, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.WATT instead, please create a bug report at https://github.com/lolouk44/CurrentCost_HA_CC/issues
To Reproduce
restart HA - warning from the core relating to this.
Expected behaviour
no warning on startup
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop/Server/Device (please complete the following information):
Additional context
Add any other context about the problem here.
Logs
Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant.
To Enable debug logging level, add this to your configuration.yaml and restart:
logger:
default: error
logs:
custom_components.currentcost: debug
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.