GithubHelp home page GithubHelp logo

rsnodgrass / hass-poolmath Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 10.0 326 KB

Pool Math for Home Assistant

License: Other

Python 97.56% Shell 2.44%
hacktoberfest hacs home-automation homeassistant pool swimming-pool

hass-poolmath's Introduction

Random Interests

  • large scale & distributed systems
  • home automation & IoT: Home Assistant
  • AV

hass-poolmath's People

Contributors

crallh avatar hwikene avatar jimangel avatar rsnodgrass avatar wrt54g 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

Watchers

 avatar  avatar  avatar  avatar

hass-poolmath's Issues

Last update killed it.

Logger: homeassistant.components.sensor
Source: custom_components/poolmath/sensor.py:127
Integration: Sensor (documentation, issues)
First occurred: 18:11:58 (1 occurrences)
Last logged: 18:11:58

poolmath: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
await task
File "/config/custom_components/poolmath/sensor.py", line 127, in async_update
pool = poolmath_json.get('pools')[0].get('pool')
IndexError: list index out of range

No Version Key Error

Logger: homeassistant.loader
Source: loader.py:786
First occurred: 11:17:27 AM (1 occurrences)
Last logged: 11:17:27 AM

No 'version' key in the manifest file for custom integration 'poolmath'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'poolmath'

Last update gave new errors

Last update gave new error logs.
Logger: homeassistant.components.sensor
Source: custom_components/poolmath/sensor.py:182
Integration: Sensor (documentation, issues)
First occurred: 11:25:49 (1 occurrences)
Last logged: 11:25:49

poolmath: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
await task
File "/config/custom_components/poolmath/sensor.py", line 146, in async_update
timestamp = await client.process_log_entry_callbacks(
File "/config/custom_components/poolmath/client.py", line 107, in process_log_entry_callbacks
await async_callback(measurement, timestamp, value, attributes)
File "/config/custom_components/poolmath/sensor.py", line 182, in _update_sensor_callback
LOG.info(f"{self._name} {log_type}={state} (timestamp={timestamp})")
NameError: name 'log_type' is not defined

poolmath: Error on device update!

This integration hasn't worked for me in a while. I have deleted and reinstalled the poolmath HACS integration and keep getting the same error. Any suggestions?

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 737, in async_device_update
await task
File "/config/custom_components/poolmath/sensor.py", line 120, in async_update
timestamp = await client.process_log_entry_callbacks(
File "/config/custom_components/poolmath/client.py", line 51, in process_log_entry_callbacks
log_entries = poolmath_soup.find_all("div", class
="logCard")
AttributeError: 'NoneType' object has no attribute 'find_all'

Error setting up platform after install

Thank you for putting together this integration for Home Assistant. I'm looking forward to using it this season. I added the integration through HACS, and added the YAML to the configuration, but am getting an error when I restart the server. I checked the custom_components folder, and the file for Pool Math are there. Here is the log entry:

Logger: homeassistant.components.sensor
Source: custom_components/poolmath/sensor.py:72
Integration: Sensor (documentation, issues)
First occurred: 10:31:18 PM (1 occurrences)
Last logged: 10:31:18 PM

Error while setting up poolmath platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/poolmath/sensor.py", line 50, in setup_platform
    client = PoolMathClient(config, add_entities)
  File "/config/custom_components/poolmath/sensor.py", line 72, in __init__
    pool_name = self._raw_data.select('h1')[0].string
IndexError: list index out of range

Not sure what I did wrong. I did subscribe to the premium service, and received my custom URL which I used in the config.

Thanks,

Jason

Sensor(s) not being created.

Fresh installation (of integration) on:

Home Assistant Core 2022.6.6
Home Assistant Supervisor 2022.05.3
Home Assistant OS 8.2

Added the following line to my configuration.yaml

sensor:
  - platform: poolmath
    url: https://api.poolmathapp.com/share/MyPOOL

Restarted HA but the sensors never get created. Tried a full device reboot as well.

Home Assistant Core logs show a hang up loading sensor platform then some errors:

2022-06-15 13:36:16 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform poolmath is taking over 10 seconds.
2022-06-15 13:36:16 ERROR (MainThread) [homeassistant.components.sensor] poolmath: Error on device update!
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 218, in connect_tcp
await event.wait()
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1842, in wait
if await self._event.wait():
File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 218, in connect_tcp
await event.wait()
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 658, in __aexit__
raise CancelledError
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_tasks.py", line 118, in __exit__
raise TimeoutError
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
stream = await self._connect(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
return await self._backend.connect_tcp(
File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc)
httpcore.ConnectTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
await task
File "/config/custom_components/poolmath/sensor.py", line 117, in async_update
soup = await client.async_update()
File "/config/custom_components/poolmath/client.py", line 34, in async_update
response = await client.request("GET", self._url, timeout=self._timeout)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1614, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1716, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout

Fail to Update

After updating to core-2021.8.2 it no longer updates the values. However the link is good. I can display the values via web browser.

New poolmatg app

Since the new pool math app came out, it doesn't look like the sensor data is populated in home assistant. Am I missing something?

Targets as gauge

Great job on the add-on -very useful!

I am new to Home Assistant development, but I wanted to see if there is anything I can do to help. Specifically, I noticed you added different targets/ranges: https://github.com/rsnodgrass/hass-poolmath/blob/master/custom_components/poolmath/targets.yaml

Are these values available in HA yet? I could see them as great way to configure different UI elements, like Gauges, with red/yellow/green configured based on a selected target for each sensor: https://www.home-assistant.io/lovelace/gauge/

Deprecated Constant

From the HA logs…

Source: helpers/deprecation.py:205
First occurred: 8:36:18 PM (4 occurrences)
Last logged: 8:36:27 PM

TEMP_FAHRENHEIT was used from poolmath, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead, please create a bug report at https://github.com/rsnodgrass/hass-poolmath/issues

Feature Request: Add Last Tested Date

Can you add the Last Test Date/Time as an attribute?

In HA the Last Updated only changes if the state changes. Add a new attribute called Last Tested and pull from the .json i.e. "fcTs": "2024-06-14T21:54:58Z".

Love the plug-in, here's a screenshot of my dashboard:

image

Parsing HTML is no fun, how about json instead?

Hey there, this is really cool! I'm the author of Pool Math and stumbled across this. I don't use HASS myself, but I'm very familiar with it (I've got a smartthings hub, homebridge, other home automations...).

Anyway, I see you're scraping HTML, and that's first of all no fun to do, and second of all, while I appreciate the 15 min sleep you have to take it easy on our servers, having JSON would make our servers work even less hard for this 😂

So, I took the liberty of quickly adding support to get this API call back in JSON instead. Just add .json to the end of the API Call:

https://api.poolmathapp.com/share/tfp-168502.json

Cheers!

Integration only PH & FC entities available

Hi @rsnodgrass,

Firstly thanks for creating this integration. I've successfully installed and had no issue pulling data for PH & FC, however I am unable to get any of the other entities to be available.

My logs show this:
2020-02-09 12:47:44 WARNING (SyncWorker_4) [custom_components.poolmath.sensor] Unknown Pool Math sensor 'cc' discovered at https://api.poolmathapp.com/share/mqxyPPr 2020-02-09 12:47:45 WARNING (SyncWorker_4) [custom_components.poolmath.sensor] Unknown Pool Math sensor 'temp' discovered at https://api.poolmathapp.com/share/mqxyPPr 2020-02-09 12:47:45 WARNING (SyncWorker_4) [custom_components.poolmath.sensor] Unknown Pool Math sensor 'csi' discovered at https://api.poolmathapp.com/share/mqxyPPr 2020-02-09 12:47:46 WARNING (SyncWorker_13) [custom_components.poolmath.sensor] Unknown Pool Math sensor 'cc' discovered at https://api.poolmathapp.com/share/mqxyPPr

I've had a look around the /config/custom_components/poolmath/sensor.py file and with my very limited code knowledge, I can't see why HA can't see these. Is there additional steps required to add these manually?

Cant update addon

Cant update the addon.

image

The log gave this:

2024-05-23 15:25:02.402 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140246085166144] Error handling message: Unknown error (unknown_error) Christian from 127.0.0.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/config/custom_components/hacs/websocket/repository.py", line 232, in hacs_repository_download
await repository.update_repository(force=True)
File "/config/custom_components/hacs/utils/decorator.py", line 28, in wrapper
result = await function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hacs/repositories/integration.py", line 126, in update_repository
if manifest := await self.async_get_integration_manifest():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hacs/repositories/integration.py", line 182, in async_get_integration_manifest
return json_loads(decode_content(response.data.content))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/json.py", line 48, in json_loads
return orjson.loads(__obj) # type:ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: unexpected control character in string: line 4 column 23 (char 95)

uninstalled it to se if i could re install it but now i cant get it installed again.

this is in the log:

Felet härrör från en anpassad integration.

Logger: custom_components.hacs
Källa: custom_components/hacs/websocket/repository.py:265
integration: HACS (dokumentation, ärenden)
Inträffade först: 15:24:43 (1 händelser)
Senast loggade: 15:24:43

<Integration rsnodgrass/hass-poolmath> unexpected control character in string: line 4 column 23 (char 95)

Unknown Pool Math sensor 'bor' discovered at https://api.poolmathapp.com/share/XXXX

Hello,
Great work on this sensor! It's nice to see my pool values in HA now. I noticed in the log file that I am getting the following error:

[custom_components.poolmath.sensor] Unknown Pool Math sensor 'bor' discovered at https://api.poolmathapp.com/share/XXXXX

I have a pool and a hot tub in there and both report the same error.

Here are some details on my environment:
Pool Math Release: 0.0.4 using HACS
HACS: 1.6.0
System: HassOS 4.13 (armv7 / raspberrypi4)
Home Assistant: 0.115.2
Home Assistant Supervisor: 245

sensors unavailable

I have used this for a few months, but since core-2022.3.6 it get unavailable for the sensors.

image

Running the client.py from a computer shows that it pulls the correct values from the web page. However, they don't appear to update the sensor values.

thanks

inherit SensorEntity unsupported in 2022.7

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:650
First occurred: 14:28:22 (1 occurrences)
Last logged: 14:28:22

Temperature sensor sensor.pool_temp_2 (<class 'custom_components.poolmath.sensor.UpdatableSensor'>) does not inherit SensorEntity, this will be unsupported in Home Assistant Core 2022.7.Please report it to the custom component author.

What type of sensors

Just out of curiosity, what kind/type of sensors can be used in market to be able to automate this calculations. Maybe connecting to a esp module to feed homeassistant sensors. I looked up on ebay didn't see any module that can measure ph and other stuff bundled. Mostly handled tools for immediate tests.

Warning that custom component is using device_state_attributes

Thanks for the integration.

Running core-2022.3.5, the log showed custom component is using device_state_attributes, so I renamed device_state_attributes to extra_state_attributes as in suggested in community.home-assistant.io.

Now, I get

poolmath: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 737, in async_device_update
    await task
  File "/config/custom_components/poolmath/sensor.py", line 120, in async_update
    timestamp = await client.process_log_entry_callbacks(
  File "/config/custom_components/poolmath/client.py", line 51, in process_log_entry_callbacks
    log_entries = poolmath_soup.find_all("div", class_="logCard")
AttributeError: 'NoneType' object has no attribute 'find_all'

Thanks

F instead of C

Hi!
My temp sensor displays as F in home assistant but as C in poolmath, is there a way i can change that in the component files?
Screenshot_2023-05-21-10-40-11-866_com android chrome
Screenshot_2023-05-21-10-39-19-870_io homeassistant companion android

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.