esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Climate heat action doesn't start at restart #3871

Open kristjanbjarni opened 1 year ago

kristjanbjarni commented 1 year ago

The problem

When you restart and if the temperature is below the default_target_temperature_low then heating action isn't started as would be expected. Only when the temperature goes from high to low over the default_target_temperature_low threshold does the heat action start. I would expect that the climate controller should evalutate it's state at start and start any action that is required.

Which version of ESPHome has the issue?

2022.11.4

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.11.5

What platform are you using?

ESP8266

Board

Sonoff TH16

Component causing the issue

climate

Example YAML snippet

substitutions:
  devicename: th16_2

esphome:
  name: ${devicename}
  comment: Heating wire
  platform: ESP8266
  board: esp01_1m

wifi:
  reboot_timeout: 0s
  networks:
  - ssid: "Skynet"
    password: !secret wifi
  - ssid: "Skynet_3H"
    password: !secret wifi
  ap:
    ssid: "${devicename}_fallback"
    password: !secret wifi

captive_portal:

logger:

api:
  reboot_timeout: 0s

ota:

binary_sensor:
  - platform: gpio
    id: push_button
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    internal: true
    on_press:
      - switch.toggle: manual

switch:
  - platform: restart
    name: "${devicename} Restart"
  - platform: gpio
    pin: GPIO12
    id: relay
    name: "${devicename} Relay"
  - platform: gpio
    id: blue_led
    pin:
      number: GPIO13
      inverted: True
  - platform: template
    name: "${devicename} Manual"
    id: manual
    lambda: |-
      return id(blue_led).state;
    turn_on_action:
      if:
        condition:
          - switch.is_off: relay
        then:
          - switch.turn_on: relay
          - switch.turn_on: blue_led
        else:
          - switch.turn_on: blue_led
    turn_off_action:
      if:
        condition:
          - switch.is_on: relay
        then:
          - switch.turn_off: relay
          - switch.turn_off: blue_led
  - platform: template
    name: "${devicename} Automation"
    id: automation
    lambda: |-
      return id(relay).state and not id(blue_led).state;
    turn_on_action:
      if:
        condition:
          - switch.is_off: relay
        then:
          - switch.turn_on: relay
    turn_off_action:
      if:
        condition:
          - switch.is_off: blue_led
        then:
          - switch.turn_off: relay
  - platform: template
    name: "${devicename} Custom"
    id: custom
    lambda: |-
      return id(relay).state;
    turn_on_action:
      - switch.turn_on: relay
      - switch.turn_on: blue_led
    turn_off_action:
      if:
        condition:
          - switch.is_on: blue_led
        then:
          - switch.turn_off: blue_led

dallas:
  - pin: GPIO14

sensor:
  - platform: dallas
    address: 0xE63C01D075EC8028
    id: temperature
    name: "${devicename} Temperature"
    filters:
      - filter_out: nan
  - platform: uptime
    name: "${devicename} Uptime Sensor"
    id: uptime_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? String(days) + "d " : "") +
                (hours ? String(hours) + "h " : "") +
                (minutes ? String(minutes) + "m " : "") +
                (String(seconds) + "s")
              ).c_str();

text_sensor:
  - platform: template
    name: "${devicename} Uptime Human Readable"
    id: uptime_human
    icon: mdi:clock-start

climate:
  - platform: thermostat
    name: "${devicename} Temperature Controller"
    id: temperature_controller
    sensor: temperature
    min_idle_time: 30s
    heat_deadband: 0.1
    heat_overrun: 0.1
    visual:
      min_temperature: 0
      max_temperature: 10
      temperature_step: 0.5
    min_heating_off_time: 60s
    min_heating_run_time: 60s
    heat_action:
      - switch.turn_on: automation
    idle_action:
      - switch.turn_off: automation
    on_boot_restore_from: default_preset
    default_preset: Home
    preset:
      -  name: Home
         default_target_temperature_low: 3.5

Anything in the logs that might be useful for us?

INFO Starting log output from th16_2.local using esphome API
INFO Successfully connected to th16_2.local
[23:09:38][I][app:102]: ESPHome version 2022.11.4 compiled on Dec  3 2022, 17:51:01
[23:09:38][C][wifi:504]: WiFi:
[23:09:38][C][wifi:362]:   Local MAC: C8:2B:96:05:1E:23
[23:09:38][C][wifi:363]:   SSID: [redacted]
[23:09:38][C][wifi:364]:   IP Address: 192.168.3.178
[23:09:38][C][wifi:365]:   BSSID: [redacted]
[23:09:38][C][wifi:367]:   Hostname: 'th16_2'
[23:09:38][C][wifi:369]:   Signal strength: -69 dB ▂▄▆█
[23:09:38][C][wifi:373]:   Channel: 13
[23:09:38][C][wifi:374]:   Subnet: 255.255.255.0
[23:09:38][C][wifi:375]:   Gateway: 192.168.3.1
[23:09:38][C][wifi:376]:   DNS1: 208.67.220.220
[23:09:38][C][wifi:377]:   DNS2: 192.168.3.1
[23:09:38][C][logger:293]: Logger:
[23:09:38][C][logger:294]:   Level: DEBUG
[23:09:38][C][logger:295]:   Log Baud Rate: 115200
[23:09:38][C][logger:296]:   Hardware UART: UART0
[23:09:38][C][switch.gpio:050]: GPIO Switch 'th16_2 Relay'
[23:09:38][C][switch.gpio:051]:   Pin: GPIO12
[23:09:38][C][switch.gpio:073]:   Restore Mode: Restore (Defaults to OFF)
[23:09:38][C][switch.gpio:050]: GPIO Switch 'blue_led'
[23:09:38][C][switch.gpio:051]:   Pin: GPIO13
[23:09:38][C][switch.gpio:073]:   Restore Mode: Restore (Defaults to OFF)
[23:09:38][C][template.switch:058]: Template Switch 'th16_2 Manual'
[23:09:38][C][template.switch:059]:   Restore State: NO
[23:09:38][C][template.switch:060]:   Optimistic: NO
[23:09:38][C][template.switch:058]: Template Switch 'th16_2 Automation'
[23:09:38][C][template.switch:059]:   Restore State: NO
[23:09:38][C][template.switch:060]:   Optimistic: NO
[23:09:38][C][template.switch:058]: Template Switch 'th16_2 Custom'
[23:09:38][C][template.switch:059]:   Restore State: NO
[23:09:38][C][template.switch:060]:   Optimistic: NO
[23:09:38][C][template.text_sensor:021]: Template Sensor 'th16_2 Uptime Human Readable'
[23:09:38][C][template.text_sensor:021]:   Icon: 'mdi:clock-start'
[23:09:38][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'push_button'
[23:09:38][C][gpio.binary_sensor:016]:   Pin: GPIO0
[23:09:38][C][uptime.sensor:031]: Uptime Sensor 'th16_2 Uptime Sensor'
[23:09:38][C][uptime.sensor:031]:   Device Class: 'duration'
[23:09:38][C][uptime.sensor:031]:   State Class: 'total_increasing'
[23:09:38][C][uptime.sensor:031]:   Unit of Measurement: 's'
[23:09:38][C][uptime.sensor:031]:   Accuracy Decimals: 0
[23:09:38][C][uptime.sensor:031]:   Icon: 'mdi:timer-outline'
[23:09:38][C][restart:022]: Restart Switch 'th16_2 Restart'
[23:09:38][C][restart:022]:   Icon: 'mdi:restart'
[23:09:38][C][dallas.sensor:075]: DallasComponent:
[23:09:38][C][dallas.sensor:076]:   Pin: GPIO14
[23:09:38][C][dallas.sensor:077]:   Update Interval: 60.0s
[23:09:38][D][dallas.sensor:082]:   Found sensors:
[23:09:38][D][dallas.sensor:084]:     0xe63c01d075ec8028
[23:09:38][C][dallas.sensor:089]:   Device 'th16_2 Temperature'
[23:09:38][C][dallas.sensor:089]:     Device Class: 'temperature'
[23:09:38][C][dallas.sensor:089]:     State Class: 'measurement'
[23:09:38][C][dallas.sensor:089]:     Unit of Measurement: '°C'
[23:09:38][C][dallas.sensor:089]:     Accuracy Decimals: 1
[23:09:38][C][dallas.sensor:091]:     Index 0
[23:09:38][C][dallas.sensor:097]:     Address: 0xe63c01d075ec8028
[23:09:38][C][dallas.sensor:098]:     Resolution: 12
[23:09:38][C][thermostat.climate:1261]: Thermostat 'th16_2 Temperature Controller'
[23:09:38][C][thermostat.climate:1266]:   Start-up Delay Enabled: NO
[23:09:38][C][thermostat.climate:1280]:   Heating Parameters:
[23:09:38][C][thermostat.climate:1281]:     Deadband: 0.1°C
[23:09:38][C][thermostat.climate:1282]:     Overrun: 0.1°C
[23:09:38][C][thermostat.climate:1288]:     Minimum Off Time: 60s
[23:09:38][C][thermostat.climate:1289]:     Minimum Run Time: 60s
[23:09:38][C][thermostat.climate:1301]:   Minimum Idle Time: 30s
[23:09:38][C][thermostat.climate:1302]:   Supports AUTO: NO
[23:09:38][C][thermostat.climate:1303]:   Supports HEAT/COOL: NO
[23:09:38][C][thermostat.climate:1304]:   Supports COOL: NO
[23:09:38][C][thermostat.climate:1305]:   Supports DRY: NO
[23:09:38][C][thermostat.climate:1306]:   Supports FAN_ONLY: NO
[23:09:38][C][thermostat.climate:1307]:   Supports FAN_ONLY_ACTION_USES_FAN_MODE_TIMER: NO
[23:09:38][C][thermostat.climate:1309]:   Supports FAN_ONLY_COOLING: NO
[23:09:38][C][thermostat.climate:1313]:   Supports FAN_WITH_HEATING: NO
[23:09:38][C][thermostat.climate:1314]:   Supports HEAT: YES
[23:09:38][C][thermostat.climate:1315]:   Supports FAN MODE ON: NO
[23:09:38][C][thermostat.climate:1316]:   Supports FAN MODE OFF: NO
[23:09:38][C][thermostat.climate:1317]:   Supports FAN MODE AUTO: NO
[23:09:38][C][thermostat.climate:1318]:   Supports FAN MODE LOW: NO
[23:09:38][C][thermostat.climate:1319]:   Supports FAN MODE MEDIUM: NO
[23:09:38][C][thermostat.climate:1320]:   Supports FAN MODE HIGH: NO
[23:09:38][C][thermostat.climate:1321]:   Supports FAN MODE MIDDLE: NO
[23:09:38][C][thermostat.climate:1322]:   Supports FAN MODE FOCUS: NO
[23:09:38][C][thermostat.climate:1323]:   Supports FAN MODE DIFFUSE: NO
[23:09:38][C][thermostat.climate:1324]:   Supports SWING MODE BOTH: NO
[23:09:38][C][thermostat.climate:1325]:   Supports SWING MODE OFF: NO
[23:09:38][C][thermostat.climate:1326]:   Supports SWING MODE HORIZONTAL: NO
[23:09:38][C][thermostat.climate:1327]:   Supports SWING MODE VERTICAL: NO
[23:09:38][C][thermostat.climate:1328]:   Supports TWO SET POINTS: NO
[23:09:38][C][thermostat.climate:1330]:   Supported PRESETS: 
[23:09:38][C][thermostat.climate:1334]:     Supports HOME: YES
[23:09:38][C][thermostat.climate:940]:       HOME Is Default: YES
[23:09:38][C][thermostat.climate:947]:       HOME Default Target Temperature Low: 3.5°C
[23:09:38][C][thermostat.climate:1338]:   Supported CUSTOM PRESETS: 
[23:09:38][C][thermostat.climate:1345]:   On boot, restore from: DEFAULT_PRESET

Additional information

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.