Automation for Thermometer

Hi Folks,

I am pretty new to home assistant and would like help with setting up an automation to turn on a z-wave switch when a thermometer temperature reaches a low threshold and off when is reaches a high threshold. Below is what I have so far which turns the switch on for 1.5 hours and then back off again. The temperature gauge is currently set up (it’s in a sauna) and it’s working. The gauge in located in the “Entities” area of home assistant. I installed the gauge using this article: Sensorpush humidity and temperature sensors

Any help would be greatly appreciated!

John

Rather than automating a thermostat, you could use this:

Thanks Tom! How do I install this? I tried to use the “Add Integration” option but could not find “Generic Thermostat”.

It’s a default integration, so you don’t need to install it. Just add the example code to your configuration.yaml and then adjust according to your devices.

?

There are integrations that are installed by default and they are grouped under default_config. However, Generic Thermostat is not one of them.

Copy-pasting the ‘example code’ to configuration.yaml, and then restarting Home Assistant to load it, is the very definition of installing an integration (i.e. a traditional integration that doesn’t use the ‘config flow’ method of installation).

I could have worded my post more precisely, and no doubt there’s a good reason why HA uses “install” in a way which is slightly different from how most users would understand it. The point remains that there’s no need to use the “Add integration” option in this case.

The point remains that Generic Thermostat is not a “default integration” (a concept that does exist but excludes Generic Thermostat) and is unavailable for use until it’s explicitly specified in configuration.yaml.

To be precise, climate is the integration and Generic Thermostat is a climate platform.

I think the word EKC is looking for is “core” integration. As opposed to a third party integration.

Core integration (if it’s in the docs): configure it via yaml or UI (and sometimes restart) then you are good to go.

Third party integration (documented elsewhere): must be installed as per the developers instructions. Then configure it via yaml or UI (and sometimes restart) then you are good to go.

Configuration > Integrations > Add integration is exclusively for integrations that support the config-flow method. They can be part of the official set maintained by the development team or custom integrations.

The traditional way to do the same thing is by appending relevant information to configuration.yaml and then restarting Home Assistant to load the new integration (or platform).

Many integrations were converted to the config-flow method but many continue to use the traditional way (like Generic Thermostat).

There are in fact default integrations and they are grouped under one default_config option (which can be disabled and then the user becomes responsible for managing the integrations it represents).

Hi Guys!

Your suggestions worked! I have the thermometer configured!

I have one more question on this. Is there a way I can set home assistant to turn the thermometer on for 1.5 hours when I press a button, then turn it off? I tried to create an automation to do this with the “delay” setting and it looks like it will only work with “Devices” and this is not a device but an “Entity”. Any suggestions?

Thanks!

For the turn on button card:

type: button
name: Turn On 
show_state: true
tap_action:
  action: call-service
  service: climate.turn_on
  service_data:
    entity_id: climate.your_thermostat_here

To automatically turn off after 1.5 hours create this automation:

trigger:
  - platform: state
    entity_id: climate.your_thermostat_here
    to: 'heat'
    for:
      minutes: 90
action:
  - service: climate.turn_off
    target:
      entity_id: climate.your_thermostat_here

Thank you kindly Tom! I added your lines of code to the configuration.yaml file and now get this error:

Do you know what might be causing this? There is the whole current thermometer section:

# Thermometer
climate:
  - platform: generic_thermostat
    name: Sauna Thermostat
    unique_id: sauna.thermostat
    heater: switch.direct_wire_indoor_outdoor_smart_switch
    target_sensor: sensor.sauna_temperature
    min_temp: 137
    max_temp: 139
    ac_mode: false
    target_temp: 139
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    min_cycle_duration:
      seconds: 5
    initial_hvac_mode: "off"
    away_temp: 16
    precision: 0.1
    
type: button
name: Turn On 
show_state: true
tap_action:
  action: call-service
  service: climate.turn_on
  service_data:
    entity_id: climate.sauna_thermostat
    
trigger:
  - platform: state
    entity_id: climate.sauna_thermostat
    to: 'heat'
    for:
      minutes: 90

action:
  - service: climate.turn_off
    target:
      entity_id: climate.sauna_thermostat

If you put all of that into the configuration.yaml then it’s understandable why you got the error message you did (because most of it is in the wrong place).

Is that what you did?


This belongs in a Button Card.

type: button
name: Turn On 
show_state: true
tap_action:
  action: call-service
  service: climate.turn_on
  service_data:
    entity_id: climate.sauna_thermostat

This belongs in automations.yaml and it’s missing important information (like alias)

 
trigger:
  - platform: state
    entity_id: climate.sauna_thermostat
    to: 'heat'
    for:
      minutes: 90

action:
  - service: climate.turn_off
    target:
      entity_id: climate.sauna_thermostat

I’ll let tom_l help you sort out the details since he has been the lead on this topic. Good luck!

What I wrote was just the important parts of the automation, the trigger and the action, you still have to write the rest yourself.

Thanks for the advice Tom. I do not know enough to write the additional code. Are there any folks that do consulting that you are aware of that I could hire to help?