Lego,
Any update on this component.
I have a TX60 sensor on my hot tub and would love to get this working
Lego,
Any update on this component.
I have a TX60 sensor on my hot tub and would love to get this working
Hi Legomaniac,
With the HA 108 update, this component no longer continues past the errors you call out in your first post here. It fails to load the sensors now. The only error in the logs is the error Error doing job: Task exception was never retrieved
for the ambient sensor. Not know python very well, I attempted to modify the code to ignore the exceptions using a try
and except: pass
but it didnât make any difference. Iâm going to continue to look into the errors, but if you could help, thatâd be much appreciated!
I managed to create a workaround for HA 108 and for the 3 exception errors you receive at boot. I split each sensor into itâs own custom component and added each separately to my sensors.yaml. Itâs not ideal, but itâs working without errors. Maybe that will help point you in the right direction for the over all component. My (uneducated) guess is that it has something to do with nested classes being called in the wrong order⌠maybe. Below is part of the code for an individual sensor that I chopped up from your code.
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the lacrosse alerts mobile platform."""
from deps.pylacrossapi import lacrosse as lacrosse
device_id = config.get(CONF_ID)
unit_measure = 0
time_zone = 10
lacrosse_device = lacrosse(device_id, unit_measure, time_zone)
add_devices([LaCrosseAmbientSensor(lacrosse_device)])
class LaCrosseAmbientSensor(Entity):
"""Representation of a LaCrosse Alerts Mobile Sensor."""
def __init__(self, lacrosse_device):
"""Initialize the sensor."""
self._lacrosse_device = lacrosse_device
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'Outside Ambient'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_FAHRENHEIT
def update(self):
obs = self._lacrosse_device.getObservation(1)
self._state = obs[0]['ambient_temp']
I got this working for 2 of my TX60âs, using the edit above by @Hassiopeia - thanks for this!!
Iâm not great at python but Iâm looking forward to troubleshooting this over the holidays - I have a bunch of these temperature sensors and would love to integrate them all, including each TX60âs probe, ambient temp and humidity values.
For others, this is what I had to do:
{
"domain": "lacrosse_alerts_mobile",
"name": "lacrosse_alerts_mobile",
"version": "1.0",
"documentation": "https://github.com/regulad/hass_lacrosse_alerts_mobile",
"dependencies": [],
"requirements": ["pylacrossapi==0.3"],
"codeowners": ["Legomaniac", "regulad"]
}
2: Edit the sensor.py:
import logging
import voluptuous as vol
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA
from homeassistant.const import TEMP_FAHRENHEIT, CONF_ID
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['pylacrossapi==0.3']
_LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ID): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the lacrosse alerts mobile platform."""
import pylacrossapi
device_id = config.get(CONF_ID)
unit_measure = 0
time_zone = 10
lacrosse_device = pylacrossapi.lacrosse(device_id, unit_measure, time_zone)
LaCrosseProbeSensor(lacrosse_device), LaCrosseHumidSensor(lacrosse_device)])
add_devices([LaCrosseAmbientSensor(lacrosse_device)])
add_devices([LaCrosseProbeSensor(lacrosse_device)])
class LaCrosseAmbientSensor(Entity):
"""Representation of a LaCrosse Alerts Mobile Sensor."""
def __init__(self, lacrosse_device):
"""Initialize the sensor."""
self._lacrosse_device = lacrosse_device
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'Lacrosse.Ambient_Temp'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_FAHRENHEIT
def update(self):
obs = self._lacrosse_device.getObservation(1)
self._state = obs[0]['ambient_temp']
class LaCrosseProbeSensor(Entity):
"""Representation of a LaCrosse Alerts Mobile Sensor."""
def __init__(self, lacrosse_device):
"""Initialize the sensor."""
self._lacrosse_device = lacrosse_device
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'Lacrosse.Probe_Temp'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_FAHRENHEIT
def update(self):
obs = self._lacrosse_device.getObservation(2)
self._state = obs[1]['probe_temp']
sensor:
- platform: lacrosse_alerts_mobile
id: !secret lacrosse_id_pumphouse
- platform: lacrosse_alerts_mobile
id: !secret lacrosse_id_cottage
- platform: lacrosse_alerts_mobile
id: !secret lacrosse_id_hottub
- sensor:
- name: "Lacrosse - PumpHouse Temp"
unit_of_measurement: "°C"
state: >
{% set tempF = states('sensor.lacrosse_ambient_temp') | float %}
{{ (5/9 * (tempF - 32)) | round(1, default=0) }}
- name: "Lacrosse - PumpHouse Probe Temp"
unit_of_measurement: "°C"
state: >
{% set tempF = states('sensor.lacrosse_probe_temp') | float %}
{{ (5/9 * (tempF - 32)) | round(1, default=0) }}
- sensor:
- name: "Lacrosse - Old Cottage Temp"
unit_of_measurement: "°C"
state: >
{% set tempF = states('sensor.lacrosse_ambient_temp_2') | float %}
{{ (5/9 * (tempF - 32)) | round(1, default=0) }}
- sensor:
- name: "Lacrosse - Hot Tub Temp"
unit_of_measurement: "°C"
state: >
{% set hottub_C = states('sensor.lacrosse_probe_temp_3') | float %}
{{ (5/9 * (hottub_C - 32)) | round(1, default=0) }}
lacrosse_id_pumphouse: 0000000000000000
lacrosse_id_cottage: 1111111111111111
lacrosse_id_hottub: 2222222222222222
Hopefully I havenât forgotten anything, it was a lot of trial and error and relying on and learning from all the work of those done before me! These edits to NOT grab the humidity sensor, but it shouldnât be hard to do that. I just had to make separate calls in order for the ambient sensor and the probe sensor to finally work. They show up in Homeassistant with very generic names though - youâll need to rename them to something meaninigful.
This is EXTREMELY ugly, but its doing what I want for now. Would love anyone with proper python experience to fix this up.
Many, many thanks again to @legomaniac and @Hassiopeia for all the information.
Thank you @gravymaker for the work you continue to do with these sensors and the step by step process you laid out above!
I followed your process (simplified as I only have one thermometer) but when I check my configuration I get the following error:
Here is my very simple yaml file:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: systemmonitor
resources:
- type: processor_use
- type: disk_use_percent
arg: "/"
- type: disk_free
arg: "/"
- type: memory_use_percent
- type: network_in
arg: eth0
- type: throughput_network_in
arg: eth0
- type: network_out
arg: eth0
- type: throughput_network_out
arg: eth0
- type: processor_temperature
- type: last_boot
# OPTIONAL CPU Raspberry Pi Temp
- platform: command_line
name: CPU Temp
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(2) }}'
- platform: lacrosse_alerts_mobile
id: !secret lacrosse_id
Iâm sure Iâm missing something simple - any thoughts?
Might be a typo when you edited the sensors.py file? The error seems related to HA having trouble importing the custom_component. I think your configuration.yaml is ok.
I had some initial problems when downloading the files from github - are all the files in the lacrosse_mobile_alerts subdirectory you created in the custom_components directory readable / look ok?
I was able to get it working after gaining a bit more experience!
Thereâs a typo in the sensor.py file youâve pasted - line 25 should be removed (the line that reads âLaCrosseProbeSensor(lacrosse_device), LaCrosseHumidSensor(lacrosse_device)])â)
After deleting that line it was smooth sailing.
Thanks again for helping to keep some of these older sensors working.
NVM Got it to show up in HA. Will start testing now.
I know this is very old, but I was able to get this working, up until the last HA update. Now Im getting this. Anyone can help ?
Logger: homeassistant.helpers.entity
Source: custom_components/lacrosse_alerts_mobile/sensor.py:78
Integration: lacrosse_alerts_mobile (documentation)
First occurred: 12:35:44 PM (94 occurrences)
Last logged: 1:25:47 PM
Update for sensor.lacrosse_probe_temp fails
Traceback (most recent call last):
File â/usr/src/homeassistant/homeassistant/helpers/entity.pyâ, line 699, in async_update_ha_state
await self.async_device_update()
File â/usr/src/homeassistant/homeassistant/helpers/entity.pyâ, line 940, in async_device_update
await hass.async_add_executor_job(self.update)
File â/usr/local/lib/python3.11/concurrent/futures/thread.pyâ, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/config/custom_components/lacrosse_alerts_mobile/sensor.pyâ, line 78, in update
obs = self._lacrosse_device.getObservation(2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.11/site-packages/pylacrossapi/init.pyâ, line 72, in getObservation
return json.loads(page)[âdevice0â][âobsâ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: âobsâ
Any help guys ? Im assuming this is due to Python Version deprecation