KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
746 stars 123 forks source link

Calling set_temp_target_temperature while in "Eco"-Mode leads to storing of eco-temperature #502

Closed jhbruhn closed 1 year ago

jhbruhn commented 1 year ago

Prerequisites

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.9.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "5.15.67",
    "supervisor": "2022.09.1",
    "host_os": "Home Assistant OS 9.0",
    "docker_version": "20.10.17",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "scheduler": {
      "version": "v0.0.0",
      "requirements": []
    },
    "ics_calendar": {
      "version": "3.1.2",
      "requirements": [
        "ics>=0.7.2",
        "recurring_ical_events>=1.0.2b0",
        "icalendar>=4.1.0"
      ]
    },
    "spotcast": {
      "version": "v3.6.30",
      "requirements": [
        "spotify_token==1.0.0"
      ]
    },
    "miwifi": {
      "version": "2.8.2",
      "requirements": []
    },
    "ble_monitor": {
      "version": "10.4.0",
      "requirements": [
        "pycryptodomex>=3.14.1",
        "janus>=1.0.0",
        "aioblescan>=0.2.13",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "plant": {
      "version": "2.0.0",
      "requirements": []
    },
    "bodymiscale": {
      "version": "3.0.3",
      "requirements": [
        "cachetools==5.1.0"
      ]
    },
    "openplantbook": {
      "version": "1.1.0",
      "requirements": [
        "pyopenplantbook==0.0.4"
      ]
    },
    "auth_header": {
      "version": "1.4",
      "requirements": []
    },
    "adaptive_lighting": {
      "version": "1.1.0",
      "requirements": []
    },
    "climate_group": {
      "version": "0.4.2",
      "requirements": []
    },
    "thermal_comfort": {
      "version": "1.5.2",
      "requirements": []
    },
    "better_thermostat": {
      "version": "1.0.0-beta25",
      "requirements": []
    },
    "ai_thermostat": {
      "version": "0.9.3",
      "requirements": []
    },
    "samsungtv_smart": {
      "version": "0.7.7",
      "requirements": [
        "websocket-client!=1.4.0,>=0.58.0",
        "wakeonlan>=2.0.0",
        "aiofiles>=0.8.0"
      ]
    },
    "anycubic_wifi": {
      "version": "1",
      "requirements": [
        "uart-wifi==0.2.1"
      ]
    },
    "ics": {
      "version": "20211212.01",
      "requirements": [
        "recurring-ical-events",
        "icalendar>=4.0.4",
        "tzlocal",
        "integrationhelper",
        "voluptuous",
        "python-dateutil>2.7.3"
      ]
    },
    "hacs": {
      "version": "1.27.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "powercalc": {
      "version": "v0.26.1",
      "requirements": [
        "numpy>=1.21.1"
      ]
    },
    "frigate": {
      "version": "3.0.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "better_thermostat",
    "name": "Better Thermostat",
    "documentation": "https://github.com/KartoffelToby/better_thermostat",
    "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues",
    "iot_class": "local_push",
    "version": "1.0.0-beta25",
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby",
      "@RubenKelevra"
    ],
    "requirements": [],
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "B\u00fcroja",
      "thermostat": "climate.buroja_heizung",
      "temperature_sensor": "sensor.buroja_temperature",
      "window_off_delay": 0,
      "off_temperature": 20,
      "window_sensors": "binary_sensor.buroja_alle_fenster",
      "weather": "weather.home",
      "outdoor_sensor": null,
      "model": "SEA801-Zigbee/SEA802-Zigbee",
      "calibration": "local_calibration_based",
      "calibration_round": true,
      "valve_maintenance": false,
      "heat_auto_swapped": false,
      "child_lock": false,
      "homaticip": false
    },
    "thermostat": {
      "entity_id": "climate.buroja_heizung",
      "state": "heat",
      "attributes": {
        "hvac_modes": [
          "off",
          "heat",
          "auto"
        ],
        "min_temp": 5.0,
        "max_temp": 30.0,
        "target_temp_step": 0.5,
        "current_temperature": 19.0,
        "temperature": 20.0,
        "anti_scaling": "ON",
        "away_mode": "OFF",
        "battery_low": false,
        "child_lock": "UNLOCK",
        "current_heating_setpoint": 20,
        "device": {
          "applicationVersion": 85,
          "dateCode": "",
          "friendlyName": "B\u00fcroja Heizung",
          "hardwareVersion": 1,
          "ieeeAddr": "0xcc86ecfffec1f63f",
          "manufacturerID": 4098,
          "manufacturerName": "_TZE200_yw7cahqs",
          "model": "SEA801-Zigbee/SEA802-Zigbee",
          "networkAddress": 32091,
          "powerSource": "Battery",
          "stackVersion": 0,
          "type": "EndDevice",
          "zclVersion": 3
        },
        "frost_detection": "ON",
        "heating": null,
        "linkquality": 255,
        "local_temperature": 19,
        "local_temperature_calibration": 0,
        "system_mode": "heat",
        "window_detection": "OFF",
        "friendly_name": "B\u00fcroja Heizung",
        "supported_features": 1
      },
      "last_changed": "2022-10-04T12:08:53.559459+00:00",
      "last_updated": "2022-10-05T06:54:11.716260+00:00",
      "context": {
        "id": "01GEKERKBSR64GC9DH0WFTQ8P8",
        "parent_id": null,
        "user_id": null
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.buroja_temperature",
      "state": "18.94",
      "attributes": {
        "state_class": "measurement",
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "B\u00fcroja Temperature"
      },
      "last_changed": "2022-10-05T06:54:07.197226+00:00",
      "last_updated": "2022-10-05T06:54:07.197226+00:00",
      "context": {
        "id": "01GEKERJTXY7FGGJ4NQP912V0Z",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": {
      "entity_id": "binary_sensor.buroja_alle_fenster",
      "state": "off",
      "attributes": {
        "entity_id": [
          "binary_sensor.buroja_fenster_links_contact",
          "binary_sensor.buroja_fenster_rechts_contact"
        ],
        "device_class": "window",
        "friendly_name": "B\u00fcroja alle Fenster"
      },
      "last_changed": "2022-10-04T12:08:49.855172+00:00",
      "last_updated": "2022-10-04T12:08:49.855172+00:00",
      "context": {
        "id": "01GEHEC3XQMFH1ENRKRN884C7W",
        "parent_id": null,
        "user_id": null
      }
    }
  }
}

Description

When set_temp_target_temperature is called in my automation because one of the conditions changes and the device is already in the eco-mode due to a previous call to set_temp_target_temperature, expectedly the "eco-mode" temperature is stored as the temperature that will be restored on the next restore_saved_target_temperature call.

This behaviour is to be expected from these methods IMO, but it would be nice if automations could work around that. My suggestion is a binary_sensor for the eco-mode so an automation does not call set_temp_target_temperature twice.

Steps to Reproduce

  1. Set thermostat to 20° 2.set_temp_target_temperature(18)
  2. set_temp_target_temperature(18)
  3. restore_saved_target_temperature()

Expected behavior:

Thermostat is set to 20°

Actual behavior:

Thermostat is set to 18°

Versions

HA 2022.9.7

BT 1.0.0-beta25

Additional Information

KartoffelToby commented 1 year ago

This is changed in Beta 26