Thermostat with PID controller

Sounds nice :slight_smile:
Do you have an example or where can I find so I could read a code and understood how it works?

Hello everyone, I want to use this component with Oventrop actuators via a solid state relay. It is designed with a wax filler and heats up in 2 minutes to fully open the valve, will this thermostat be suitable and will I be able to configure the system?

The winter is coming and many like myself are struggling to setup this integration, I’ve found this very useful simulator that has quite been a life saver, check it out - PID Simulator download | SourceForge.net

There are two versions, I found the first one more easy to use.

Hi, is it possible to modify the preset mode icons?
After the latest OS update, I lost the mode icons. Now, the only way I can fix this issue is by setting them manually. I’ve successfully done this with the AC integration (Daikin), but I’m not able to do it with the Smart Thermostat.

I modified the icons.json file like this, but it’s not working:

{
  "services": {
    "clear_integral":  "mdi:thermostat-cog",
    "set_pid_mode": "mdi:thermostat-cog",
    "set_pid_gain":  "mdi:thermostat-cog",
    "set_preset_temp": "mdi:thermostat"
  },
  "entity": {
    "climate": {
      "smart_thermostat": {
        "state_attributes": {
          "preset_mode": {
            "state": {
              "home": "mdi:home",
              "boost": "mdi:rocket-launch"
            }
          }
        }
      }
    }
  }
}

Are anyone here still running HASmartThermostat thermostats from ? Are these still working?

As of yesterday all of mine became unavailable and reports "This entity is no longer being provided by the smart_thermostat integration. If the entity is no longer in use, delete it in settings."

Everything just stopped working yesterday at 13.30 (No update, no restart):

The log shows the following:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1437, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1070, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1145, in async_get_platforms
    import_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1133, in async_get_platforms
    platforms.update(self._load_platforms(platform_names))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1060, in _load_platforms
    platform_name: self._load_platform(platform_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1232, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/smart_thermostat/climate.py", line 38, in <module>
    from homeassistant.core import DOMAIN as HA_DOMAIN, CoreState, Event, EventStateChangedData, callback
ImportError: cannot import name 'EventStateChangedData' from 'homeassistant.core' (/usr/src/homeassistant/homeassistant/core.py)

Very odd!

/Tonkin

Go to settings, input, click add input helper and select binary (boolean) sensor template.
Set the template value to something like

{{ is_state("valve.example_valve_1", "open") or is_state("valve.example_valve_2", "open") }}

And make an automation to switch the boiler on or off based on the state of this Boolean.

I tried to add some custom presets with their own icons, but didn’t manage to make new icons appear.
But I still have all the icons on my dashboard, no icon missing in the presets.

What are the HA and integration versions?
I’m running latest releases for both, without issue.

I am running 2024.4
Saw another example of cannot import name 'EventStateChangedData' from 'homeassistant.core' that was solved by an upgrade. Might consider to upgrade!

It was a core update issue. With 2024.11.3 all the icons are back again

Good morning, I am finally using this integration for real, and I am trying to set the values.
My system is an underfloor water-based heating system, and it is very slow, with a lot of inertia. The house is newly built, and the thermal insulation is good.
I set the minimum ON time to 10 minutes because, in my opinion, with less than 10 minutes, the floor doesn’t even start to heat up.
I set the minimum OFF time to 3 minute so that it doesn’t stay off for too long (but I might have completely misunderstood the approach).
As for the PID values, I took them as a reference from a post because it seems like a system similar to mine.

This is my initial configuration, and the result.
Does this look good, or should I change something? maybe there some overshoot and it doesen’t react fast when is near the setpoint.

  target_temp_step: 0.1
  min_temp: 5
  max_temp: 28
  target_temp: 20
  cold_tolerance: 0.2
  hot_tolerance: 0.0
  keep_alive: 
    seconds: 60
  kp: 18.724
  ki: 0.015
  kd: 5802.45
  ke: 0.6
  pwm: 00:30:00
  min_cycle_duration: 00:10:00
  min_off_cycle_duration: 00:03:00

many thanks

The interesting area is during the night, where the temperature is really stable, just a bit below the target. Maybe add a bit of ke gain, maybe 0.7, and increase the kd to 7500 to reduce the overshoot seen at the beginning of the capture.

I’ll try and report back in a few days!

Hello,
I am new to ‘Thermostat with PID controller’. I have good knowledge about control techniques and PID, so this isn’t the problem.
I added the sample into my configuration.yaml and changed the entityIDs of the sensors and the switch to devices I use here and restarted HA.

Nothing happens for hours, actual temp is 20.3°C, setpoint is 24°C, just to get some action on my test switch.

I also wanted to add some user interface, so I tried the Climate Card and the Mushroom Climate Card. As I should enter the entityId in the cards configuration, the system couldn’t find one.

What did I miss?

Is there a step by step explaination how to start from scratch, adding the thermostat, connecting devices and connecting some UI. And maybe a sample to see its working somehow, switching some virtual switch or whatever.

Thanks a lot for helping.

Maybe there is also a way to get debug infos to see, whats wrong.

((Have to control two TRVs in one project and a heat pump and 10 AC splits in 10 rooms in another project))

With best regards

Gerhard

Hello, make sure you don’t use the autotune. I think I should really remove that useless feature, I never heard about someone successfully using it.
Please share your configuration yaml, you may have entities that are incompatible with the example configuration. That’s an example, there is no guaranty it’s working.

You should look at the states panel in the developer tools, click the button below:
Open your Home Assistant instance and show your state developer tools.

look for your climate.your_smart_thermostat_entity and when clicking on the name, it will show the full status in the panel above.

The control_output attribute is the output value of the PID and represent the power requirement computed by the thermostat, if it’s high and the heater remains OFF, there is an issue in the control path.
If you click on the little circled i next to the name of the thermostat in the list in the bottom, it will open the control panel of the thermostat, and by clicking on the little squared chart icon in the the top right corner of this panel, you will see the climate history, showing the set point, the measured temperature and the heating requests.

image

Hi all, I’ve been away for a long time. For heating in our own house, we also developed a PID thermostat. I chose to separate the different parts required. So I created:

The components can be installed with HACS and visually configured. We are using them now for multiple years. Have been improving here and there, and we are satisfied with it. Feel free to test!

In our own house, it works fine with the default PID settings.

Would it be possible a comprehensive stepguide on how to install all the partes and make them work?

Thank you.

Could I use this to control an element on a smoker? I would be trying to keep it around 160f

This is my current result. What do you think?

 cold_tolerance: 0.2
 hot_tolerance: 0.0
 keep_alive:
   seconds: 60
  kp: 17.362
  ki: 0.015
  kd: 8500
  ke: 0.7
 pwm: 00:30:00
 min_cycle_duration: 00:10:00
 min_off_cycle_duration: 00:03:00