aendle / custom_components

missing feature test reposetory
66 stars 33 forks source link

SmartThermostat object has no attribute '_heater_turn_off' #9

Closed Guyohms closed 4 years ago

Guyohms commented 5 years ago

I'm trying that component and I can't get it to work. Here's my config:

  - platform: smart_thermostat
    name: Test PID
    heater: switch.switch_de_test
    target_sensor: sensor.aquarium_ds18b20_temperature
    min_temp: 15
    max_temp: 30
    ac_mode: False
    target_temp: 23
    keep_alive:
      seconds: 5
    away_temp: 16
    kp : 5
    ki : 3
    kd : 2
    pwm : 1

Here's the error I get:

ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/smart_thermostat/climate.py", line 424, in _async_control_heating
    self.calc_output()
  File "/config/custom_components/smart_thermostat/climate.py", line 489, in calc_output
    self.set_controlvalue();
  File "/config/custom_components/smart_thermostat/climate.py", line 506, in set_controlvalue
    self._heater_turn_off()
AttributeError: 'SmartThermostat' object has no attribute '_heater_turn_off'

and also

ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/smart_thermostat/climate.py", line 424, in _async_control_heating
    self.calc_output()
  File "/config/custom_components/smart_thermostat/climate.py", line 489, in calc_output
    self.set_controlvalue();
  File "/config/custom_components/smart_thermostat/climate.py", line 500, in set_controlvalue
    self.pwm_switch(self.pwm * self.control_output / self.maxOut, self.pwm * (self.maxOut - self.control_output) / self.maxOut, time.time() - self.time_changed)
  File "/config/custom_components/smart_thermostat/climate.py", line 524, in pwm_switch
    self._heater_turn_on()
AttributeError: 'SmartThermostat' object has no attribute '_heater_turn_on'

Is there something I'm doing wrong ?

Guyohms commented 5 years ago

I don't know much about Python, but I looked through the code and I think I spotted a part of the issue.

There are uses of self._heater_turn_on/off where they should be self._async_heater_turn_on/off.

I tried this modification and now there is not more error message ! But... the heater switch entity_id still doesn't get toggled on or off :(

It seems like if the _async_heater_turn_on/off function is never executed. I've put _Logger.info commands before and after this function and nothing shows up in the log.