Generic thermostat(climate and fan) with Automation sporadically on\off by service with no reason

Hello everyone,
Could someone help me to understand why it acts like explained below and how to make it work properly?

I have:

Two climate entities(separate devices):

climate:

  - platform: generic_thermostat
    name: bathroom_fl_heat
    unique_id: termostat_bathroom
    heater: switch.bathroom_heater
    target_sensor: sensor.bathroom_thermostat_floor_temperature
    min_temp: 22
    max_temp: 32
    target_temp: 29
    cold_tolerance: 0.3
    hot_tolerance: 0
    away_temp: 16
    precision: 0.1
    
  - platform: generic_thermostat
    name: bathroom_wall_heat
    unique_id: termostat_bathroom_wall
    heater: switch.bathroom_wall_heater
    target_sensor: sensor.wall_bathroom_thermostat_floor_temperature
    min_temp: 22
    max_temp: 32
    target_temp: 30
    cold_tolerance: 0.3
    hot_tolerance: 0
    away_temp: 16
    precision: 0.1

Two switches:

  switch:
#Temperature heaters switchers
   - name: "Bathroom_Heater"
     unique_id: bathroom_heater
     command_topic: "/devices/wb-mr6c_31/controls/K4/on"
     state_topic: "/devices/wb-mr6c_31/controls/K4"
     payload_on: "1"
     payload_off: "0"
     retain: true

   - name: "Bathroom_Wall_Heater"
     unique_id: bathroom_wall_heater
     command_topic: "/devices/wb-mr6c_31/controls/K5/on"
     state_topic: "/devices/wb-mr6c_31/controls/K5"
     payload_on: "1"
     payload_off: "0"
     retain: true

One fan:

mqtt:
  fan:
   - name: "Bathroom Fan"
     unique_id: bathroom-fan
     state_topic: "/devices/wb-gpio/controls/EXT1_R3A2"
     command_topic: "/devices/wb-gpio/controls/EXT1_R3A2/on"
     payload_on: "1"
     payload_off: "0"

A couple of sensors:

mqtt:
  sensor:
#Temperature heaters sensors
   - name: "bathroom_thermostat_floor_temperature"
     unique_id: 4275808604
     state_topic: "/devices/wb-m1w2_205/controls/External Sensor 1"
     unit_of_measurement: '°C'
    
   - name: "wall_bathroom_thermostat_floor_temperature"
     unique_id: 4275806249
     state_topic: "/devices/wb-m1w2_212/controls/External Sensor 1"
     unit_of_measurement: '°C'
    
   - name: "guest_thermostat_floor_temperature"
     unique_id: 4275814414
     state_topic: "/devices/wb-m1w2_215/controls/External Sensor 1"
     unit_of_measurement: '°C'
    
   - name: "entrance_thermostat_floor_temperature"
     unique_id: 4275803838
     state_topic: "/devices/wb-m1w2_45/controls/External Sensor 1"
     unit_of_measurement: '°C'
    
   - name: "kitchen_thermostat_floor_temperature"
     unique_id: 4275842289
     state_topic: "/devices/wb-m1w2_244/controls/External Sensor 1"
     unit_of_measurement: '°C'
#Sensors
#Bathroom
   - name: "bathroom_sensor_temperature"
     unique_id: bathroom_sensor_temperature
     state_topic: "/devices/wb-msw-v3_103/controls/Temperature"
     device_class: 'temperature'
     unit_of_measurement: '°C'

   - name: "bathroom_sensor_humidity"
     unique_id: bathroom_sensor_humidity
     state_topic: "/devices/wb-msw-v3_103/controls/Humidity"
#     unit_of_measurement: '%'
     device_class: 'humidity'

   - name: "bathroom_sensor_sound"
     unique_id: bathroom_sensor_sound
     state_topic: "/devices/wb-msw-v3_103/controls/Sound Level"
#    unit_of_measurement: ''

   - name: "bathroom_sensor_currmotion"
     unique_id: bathroom_sensor_currmotion
     state_topic: "/devices/wb-msw-v3_103/controls/Current Motion"
#    unit_of_measurement: ''

Everything is working fine from frontend but not with Automations

In Automation I’d like to have next:

Trigger(numeric state): Sound is below 50 for 5 min
Conditions(numeric state): Humidity is above 50 and Motion is below 20
Actions:

  1. Call service Climate_Set HVAC mode to Heat for:
    climate.bathroom_fl_heat
    climate.bathroom_wall_heat
  2. Toggle Fan to ON.
alias: Fan and floor heat ON after taking shower (sound 50)
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.bathroom_sensor_sound
    below: 50
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.bathroom_sensor_humidity
        above: 50
      - condition: numeric_state
        entity_id: sensor.bathroom_sensor_currmotion
        below: 25
    enabled: true
action:
  - service: climate.set_temperature
    data:
      temperature: 30
    target:
      entity_id:
        - climate.bathroom_fl_heat
        - climate.bathroom_wall_heat
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id:
        - climate.bathroom_fl_heat
        - climate.bathroom_wall_heat
  - service: fan.toggle
    data: {}
    target:
      entity_id: fan.bathroom_fan
mode: single

Automation starts well, but in a minute or two
climate.bathroom_fl_heat and bathroom-fan turned OFF triggered by service climate.turn_off (info from log).

climate.bathroom_wall_heat stays ON.

I don’t understand why its happening, already tried many ways but the situation is still the same.

Thank you

Sorry, but not many people are going to try to puzzle this out. :wink:

You need to post your code as preformatted text (</> in the toolbar). It should look something like this:

- id: '1674224250212'
  alias: 'Battery warning: fridge'
  description: Sends SMS message when fridge wireless tag battery level is low
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.fridge_low_battery
    from: 'off'
  condition: []
  action:
  - service: notify.mobile
    data:
      message: '{{ as_timestamp(now()) | timestamp_custom(''%I:%M%p'', true) }}: Fridge
        wireless tag battery is low.'
      data:
        priority: normal
        device: REVOVIEW IMO Q4 Pro
  mode: single

The spacing at the start of each line is critical.

1 Like

I’d start by searching you configuration to calls that turn climate off. Your posted automation does not do that, so something else must be doing it.

Generic thermostat has logic built into it to turn your switch on and off based on your current temperature. Read up on that integration to learn how it works.

Yeah, no. Your fan is only being turned on and off from the bottom service, there are no links to the fan in your generic thermostat. You’re using fan.toggle by the way, that will toggle the fan. I.e. if the fan is on, that service will turn it off.