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

Heating not immediately starting - "Cycle is too short" #251

Open
somerandoname opened this issue Oct 24, 2024 · 1 comment
Open

Heating not immediately starting - "Cycle is too short" #251

somerandoname opened this issue Oct 24, 2024 · 1 comment

Comments

@somerandoname
Copy link

When switching the thermostat from 'off' to 'heat' the switch isn't immediately being turned on despite a high enough PID output.

According to the log the cycle time is too short, but with an output of 70.9 it should be well above the 'min_cycle_duration' of 6 min. What am I misunderstanding?

Log message:

2024-10-24 18:21:04.880 DEBUG (MainThread) [custom_components.smart_thermostat.climate] climate.smart_thermostat: New PID control output: 70.9 (error = 1.56, dt = 0.00, p=19.40, i=51.50, d=-0.00, e=0.00)
2024-10-24 18:21:04.880 INFO (MainThread) [custom_components.smart_thermostat.climate] climate.smart_thermostat: OFF time passed. Request turning ON switch.daikin_toggle_heating
2024-10-24 18:21:04.880 INFO (MainThread) [custom_components.smart_thermostat.climate] climate.smart_thermostat: Reject request turning ON switch.daikin_toggle_heating: Cycle is too short
Smart Thermostat config
- platform: smart_thermostat
  name: Smart Thermostat
  unique_id: smart_thermostat
  heater: switch.daikin_toggle_heating
  cooler: switch.daikin_toggle_cooling
  target_sensor: sensor.thermal_comfort_humidex
  min_temp: 12
  max_temp: 28
  ac_mode: true
  keep_alive:
    seconds: 60
  sampling_period: 0
  kp: 12.483
  ki: 0.04
  kd: 979.349
  pwm: 00:15:00
  min_cycle_duration: 00:06:00
  min_off_cycle_duration: 00:01:00
  target_temp_step: 0.1
  target_temp: 16
  eco_temp: 16
  comfort_temp: 20
  boost_temp: 21
  preset_sync_mode: sync
  sensor_stall: 0
  debug: true
Switch config
- platform: template
  switches:
    daikin_toggle_heating:
      friendly_name: "Daikin toggle heating"
      unique_id: daikin_toggle_heating
      value_template: >
        {% set state = states('climate.daikin') %}
        {% set temp = state_attr('climate.daikin, 'temperature') %}
        {{ state == 'heat' and temp == 30 }}
      turn_on:
        action: script.turn_on
        target:
          entity_id: script.daikin_on
      turn_off:
        action: script.turn_on
        target:
          entity_id: script.daikin_off

- platform: template
  switches:
    daikin_toggle_cooling:
      friendly_name: "Daikin toggle cooling"
      unique_id: daikin_toggle_cooling
      value_template: >
        {% set state = states('climate.daikin') %}
        {% set temp = state_attr('climate.daikin', 'temperature') %}
        {{ state == 'cool' and temp == 18 }}
      turn_on:
        action: script.turn_on
        target:
          entity_id: script.daikin_on
      turn_off:
        action: script.turn_on
        target:
          entity_id: script.daikin_off
@somerandoname
Copy link
Author

somerandoname commented Oct 25, 2024

I've added a device_active check before the last_heat_cycle_time is updated by the heater_turn_off function, and it seems to have fixed the issue. However, I don't know if this broke something.

heater_turn_off
async def _async_heater_turn_off(self, force=False):
	"""Turn heater toggleable device off."""
	if time.time() - self._last_heat_cycle_time >= self._min_on_cycle_duration.seconds or force:
		if self._is_device_active:
			self._last_heat_cycle_time = time.time()
		for entity in [self._heater_entity_id, self._cooler_entity_id]:
			if entity is None:
				continue
			_LOGGER.info("%s: Turning OFF %s", self.entity_id,
						 ", ".join([entity for entity in self.heater_or_cooler_entity]))
			for heater_or_cooler_entity in self.heater_or_cooler_entity:
				data = {ATTR_ENTITY_ID: heater_or_cooler_entity}
				if self._heater_polarity_invert:
					service = SERVICE_TURN_ON
				else:
					service = SERVICE_TURN_OFF
				await self.hass.services.async_call(HA_DOMAIN, service, data)
	else:
		_LOGGER.info("%s: Reject request turning OFF %s: Cycle is too short",
					 self.entity_id, ", ".join([entity for entity in self.heater_or_cooler_entity]))

Edit: The change hasn't fixed the issue. The unit turns now immediately on, but shuts off again after a few seconds.


I added more debug logs and restarted Home Assistant, after which I was not able to replicate these short duration cycles again. The unit is now turning on for at least the min duration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant