Skip to content

TypeError: must be real number, not NoneType #14

@ov1d1u

Description

@ov1d1u

Not sure if it's an ESPHome bug, but I get this only with esphome-opentherm. After I restart Home Assistant, the integration fails with this error:

Error setting up entry opentherm for esphome

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/esphome/__init__.py", line 370, in async_setup_entry
    infos, services = await entry_data.async_load_from_store()
  File "/usr/src/homeassistant/homeassistant/components/esphome/entry_data.py", line 228, in async_load_from_store
    infos.append(cls.from_dict(info))
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/model.py", line 87, in from_dict
    return cls(**init_args)
  File "<string>", line 16, in __init__
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/model.py", line 73, in __post_init__
    super().__setattr__(field_.name, convert(val))
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/util.py", line 49, in fix_float_single_double_conversion
    if value == 0 or not math.isfinite(value):
TypeError: must be real number, not NoneType

This is the yaml configuration:

substitutions:
  devicename: opentherm
  upper_devicename: Opentherm

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini
  esp8266_restore_from_flash: true

external_components:
  source: github://arthurrump/esphome-opentherm@main

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "${devicename} Fallback"
    password: !secret wifi_password

web_server:
  port: 80

captive_portal:
logger:
api:
  encryption:
    key: <redacted>
ota:
  password: <redacted>

opentherm:
  in_pin: 12
  out_pin: 14
  ch_enable: true
  dhw_enable: true

output:
  - platform: opentherm
    t_set:
      id: t_set
      min_value: 15
      auto_max_value: true
      zero_means_zero: true

number:
  - platform: opentherm
    t_dhw_set:
      name: "Boiler DHW Setpoint"
      auto_min_value: true
      auto_max_value: true
    max_t_set:
      name: "Maximum allowable CH water setpoint"

sensor:
  - platform: opentherm
    rel_mod_level:
      name: "Boiler Relative modulation level"
    t_boiler:
      name: "Boiler water temperature"
    ch_pressure:
      name: "Boiler Water pressure in CH circuit"
    t_dhw:
      name: "DHW temperature"
    t_dhw_set:
      name: "Domestic hot water temperature setpoint"
  - platform: homeassistant
    id: ch_room_temperature
    entity_id: sensor.ble_temperature_a4c1384e0601
    filters: 
      # Push room temperature every second to update PID parameters
      - heartbeat: 1s  

binary_sensor:
  - platform: opentherm
    ch_active:
      name: "Boiler Central Heating active"
    dhw_active:
      name: "Boiler Domestic Hot Water active"
    flame_on:
      name: "Boiler Flame on"
    fault_indication:
      name: "Boiler Fault indication"
      entity_category: diagnostic
    diagnostic_indication:
      name: "Boiler Diagnostic event"
      entity_category: diagnostic
    dhw_present:
      name: "Configuration: DHW present"
      entity_category: diagnostic
    ch2_present:
      name: "Configuration: CH2 present"

switch:
  - platform: opentherm
    ch_enable:
      name: "Boiler Central Heating enabled"
      mode: restore_default_on

climate:
  - platform: pid
    name: "Central heating"
    heat_output: t_set
    default_target_temperature: 20
    sensor: ch_room_temperature
    control_parameters: 
      kp: 0.4
      ki: 0.004
    deadband_parameters:
      threshold_high: 0.3°C       # deadband within +/-0.5°C of target_temperature
      threshold_low: -0.3°C
    visual:
      temperature_step: 0.5 °C

This happens with ESPHome 2023.2.4. Any idea what could trigger that error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions