homeassistant-powercalc: unhandled exception

I’ve seen this in my log recently:

Logger: homeassistant.components.sensor
Source: custom_components/powercalc/strategy/linear.py:86
Integration: Sensor (documentation, issues)
First occurred: January 8, 2022, 04:59:21 (1 occurrences)
Last logged: January 8, 2022, 04:59:21

Error while setting up powercalc platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/powercalc/sensor.py", line 207, in async_setup_platform
    entities = await create_sensors(hass, config, discovery_info)
  File "/config/custom_components/powercalc/sensor.py", line 255, in create_sensors
    return await create_individual_sensors(
  File "/config/custom_components/powercalc/sensor.py", line 349, in create_individual_sensors
    power_sensor = await create_power_sensor(
  File "/config/custom_components/powercalc/sensors/power.py", line 116, in create_power_sensor
    calculation_strategy = calculation_strategy_factory.create(
  File "/config/custom_components/powercalc/strategy/factory.py", line 47, in create
    return self._create_linear(config, light_model, source_entity)
  File "/config/custom_components/powercalc/strategy/factory.py", line 69, in _create_linear
    return LinearStrategy(linear_config, self._hass, source_entity)
  File "/config/custom_components/powercalc/strategy/linear.py", line 47, in __init__
    self._calibration = self.create_calibrate_list()
  File "/config/custom_components/powercalc/strategy/linear.py", line 86, in create_calibrate_list
    list.append((min, float(self._config.get(CONF_MIN_POWER))))
TypeError: float() argument must be a string or a number, not 'NoneType'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

Ah forgive me, pre-coffee me wasn’t understanding fully what you did there. 😃

LGTM

Haha, no worries 😉. It’s also rather complex topic. I am also no mathemetician, so programming this stuff and explaining is also no easy task for me. The linear strategy also has the calibration table (multiple calibration values) and other variables to account for, so it was a lot of work to get it right. But I’m pretty sure I have got it right now. Did a lot of testing with different scenarios.