Coder Social home page Coder Social logo

currentcost_ha_cc's People

Contributors

harvsg avatar lolouk44 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

currentcost_ha_cc's Issues

Additional documentation for HA in Docker

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.

Meter Reading

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.

State Class error


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):

  • Device used to run the Custom Component [e.g. Raspberry Pi, NUC] Raspberry Pi 4
  • Method of installation [e.g. via HACS or manual] HACS
  • Version of the Custom Component installed? 0.1.8
  • Model of the Current Cost Device unknown

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.

Serial cable

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,

HA not loading currentcost module


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):

  • Device used to run the Custom Component Raspberry pi
  • Method of installation HACS
  • Version of the Custom Component installed? 0.2.4

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'

Support intermittent serial comms


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):

  • Device used to run the Custom Component [e.g. Raspberry Pi, NUC]
  • Method of installation [e.g. via HACS or manual]
  • Version of the Custom Component installed?
  • Model of the Current Cost Device

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

Issue conecting to HA

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

Entity_id is depreciated

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.

create 2nd sensor from 1st sensor

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.

Integration is using deprecated `DEVICE_CLASS_*` constants

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):

  • Device used to run the Custom Component [e.g. Raspberry Pi, NUC]
  • Method of installation [e.g. via HACS or manual]
  • Version of the Custom Component installed?
  • Model of the Current Cost Device

Additional context

n/a

Logs

n/a

POWER_WATT was used from currentcost, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.WATT instead


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):

  • Device used to run the Custom Component [e.g. Raspberry Pi, NUC]
  • Method of installation [e.g. via HACS or manual]
  • Version of the Custom Component installed?
  • Model of the Current Cost Device

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

Error while setting up currentcost platform for sensor / Error while adding currentcost platform entities HA 2023.9

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

Temperature Data

While using a Pi3 with Home Assistant 2021.6.3 there is no data for the temperature entry.

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.