Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in callback AIThermostat.async_added_to_hass.<locals>._async_startup #25

Closed
upais opened this issue Nov 19, 2021 · 5 comments · Fixed by #26
Closed

Exception in callback AIThermostat.async_added_to_hass.<locals>._async_startup #25

upais opened this issue Nov 19, 2021 · 5 comments · Fixed by #26
Labels
bug Something isn't working duplicate This issue or pull request already exists under investigation If its not clear whats the problem
Milestone

Comments

@upais
Copy link

upais commented Nov 19, 2021

TRV Model: BRT-100-TRV
Z2M Version: 1.22.0-2
HA Version: 2021.11.4
ai_thermostat version: 0.4.0
weather integration: Meteorologisk institutt (Met.no)

Config ai_thermostat:

  - platform: ai_thermostat
    name: tvr_bedroom_vitrual
    thermostat: climate.tvr_bedroom
    temperature_sensor: sensor.temperature_humidity_bedroom_temperature
    window_sensors: group.livingroom_windows
    weather: weather.nikolskoe
    off_temperature: 20
    window_off_delay: 0
hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 19
temperature: 20
preset_mode: manual
battery: 77
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 20
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_bedroom
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffe8c3d13'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 35585
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 17
last_seen: '2021-11-20T10:20:22.741Z'
linkquality: 81
local_temperature: 19
local_temperature_calibration: 0
max_temperature: 35
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_bedroom
supported_features: 17

Description

There is an error when starting HA:

Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:217
Integration: ai_thermostat (documentation, issues)
First occurred: 18:46:06 (1 occurrences)
Last logged: 18:46:06

Error doing job: Exception in callback AIThermostat.async_added_to_hass.._async_startup(<Event homeassistant_start[L]>) at /config/custom_components/ai_thermostat/climate.py:209
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/core.py", line 835, in _onetime_listener
self._hass.async_run_job(listener, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 452, in async_run_job
return self.async_run_hass_job(HassJob(target), *args)
File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/ai_thermostat/climate.py", line 217, in _async_startup
self.mqtt.async_publish('zigbee2mqtt/'+self.hass.states.get(self.heater_entity_id).attributes.get('friendly_name')+'/set', payload, 0, False)
AttributeError: 'NoneType' object has no attribute 'attributes'

Steps to Reproduce

  1. Adding a virtual thermostat to the yaml
  2. Restart HA
@KartoffelToby
Copy link
Owner

@IvanUpa I know this bug, but thank you anyway, will be fixed in 0.5.0

But i wonder why you haven't any devices informations in your HA TRV output, have you enabled "include_device_information" in your Z2M instance?

@KartoffelToby KartoffelToby added bug Something isn't working under investigation If its not clear whats the problem labels Nov 19, 2021
@KartoffelToby KartoffelToby added this to the 0.5.0 milestone Nov 19, 2021
@KartoffelToby KartoffelToby linked a pull request Nov 19, 2021 that will close this issue
@KartoffelToby KartoffelToby added the duplicate This issue or pull request already exists label Nov 19, 2021
@upais
Copy link
Author

upais commented Nov 20, 2021

@KartoffelToby
Didn't turn it on.
I updated the information, just in case.

Thanks for the integration, waiting for the fix :)

@KartoffelToby
Copy link
Owner

@IvanUpa 0.5.0 is published, be sure to turn on include_device_information in Z2M otherwise this intigration didn't work correctly

@upais
Copy link
Author

upais commented Nov 20, 2021

@IvanUpa 0.5.0 is published, be sure to turn on include_device_information in Z2M otherwise this intigration didn't work correctly

Still an error :(

  1. include_device_information = on
  2. Removed integration and virtual thermostat from config
  3. Reboot HA.
  4. Installed the integration again from HACS
  5. Reboot HA.
  6. Created the virtual thermostat again
  7. Reboot HA

Error on startup:
Logger: homeassistant
Source: custom_components/ai_thermostat/climate.py:212
Integration: ai_thermostat (documentation, issues)
First occurred: 18:31:12 (1 occurrences)
Last logged: 18:31:12

Error doing job: Exception in callback AIThermostat.async_added_to_hass.._async_startup(<Event homeassistant_start[L]>) at /config/custom_components/ai_thermostat/climate.py:208
Traceback (most recent call last):
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/core.py", line 835, in _onetime_listener
self._hass.async_run_job(listener, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 452, in async_run_job
return self.async_run_hass_job(HassJob(target), *args)
File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/ai_thermostat/climate.py", line 212, in _async_startup
if self.startup and self.hass.states.get(self.heater_entity_id).attributes is not None:
AttributeError: 'NoneType' object has no attribute 'attributes'

@upais
Copy link
Author

upais commented Nov 22, 2021

@KartoffelToby
Problem solved, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists under investigation If its not clear whats the problem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants