that’s how i did it, and seems to work. i’ve got some input_selects to set a different temp or mode. here’s my config, although i don’t currently get the humidity state to come over, so still debugging that. “House” is the name of the thermostat device.
# House Thermostat
- platform: mqtt
name: House Temperature
state_topic: "smartthings/House/temperature"
command_topic: "smartthings/House/temperature"
unit_of_measurement: 'F'
- platform: mqtt
name: Mode
state_topic: "smartthings/House/thermostatMode" # auto | cool | heat
- platform: mqtt
name: Current State
state_topic: "smartthings/House/thermostatOperatingState" # cooling | heating | idle
- platform: mqtt
name: thermostat Setpoint
state_topic: "smartthings/House/thermostatSetpoint"
command_topic: "smartthings/House/thermostatSetpoint"
unit_of_measurement: 'F'
- platform: mqtt
name: House Humidity
state_topic: "smartthings/House/humidity"
unit_of_measurement: '%'
I have tried the new MQTT climate function and that seems to only half work, it does nothing to update the thermostat and does not even post the correct payloads that I’ve specified. There seem to be posts of people saying they have this working but absolutely nothing about how to get it working. Posting new data to these topics does not affect the thermostat at all.
OK, so I finally had the time to sit down and sort it out. I had to pretty much build the thermostat interface from scratch because the default MQTT Climate controls do not work with my thermostat. The reason for that is that mine doesn’t have a single target temperature, it has a separate heating and cooling target and those must be set separately. I could probably create an automation that changes the setpoint for whichever mode it is in, but then I could never use auto mode if I wanted to.
If anyone has questions about this code please just ask, sorry if the formatting got messed up. One big tip for sending payload over MQTT, make sure ON is in the code as “ON” with quotes, otherwise HASS sends True as the payload.
The MQTT topics should pretty much be the same for you, but my thermostat is named “Thermostat” which you’ll need to change to match yours in the middle of the topic. EX: smartthings/THENAMEOFYOURTHERMOSTAT/tempurature
Configuration.yaml
#These are the sensors for the temperature, humidity, current state, and battery level. One way communication
sensor: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
- platform: mqtt
name: "East Hall Temperature"
state_topic: "smartthings/Thermostat/temperature"
unit_of_measurement: '°F'
- platform: mqtt
name: "East Hall Thermostat Current State"
state_topic: "smartthings/Thermostat/thermostatOperatingState" # cooling | heating | idle
- platform: mqtt
name: "East Hall Humidity"
state_topic: "smartthings/Thermostat/humidity"
unit_of_measurement: '%'
- platform: mqtt
name: "East Hall Thermostat Battery"
state_topic: "smartthings/Thermostat/battery"
unit_of_measurement: '%'
#This is the switch for the fan mode, auto or on.
switch: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
- platform: mqtt
name: "East Hall Thermostat fan Mode"
state_topic: "smartthings/Thermostat/thermostatFanMode" # auto | on
command_topic: "smartthings/Thermostat/thermostatFanMode" # auto | on
payload_on: "on"
payload_off: "auto"
##This is the drop down box for the thermostat modes.
input_select: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
thermostat_mode:
name: Thermostat Mode
options:
- "auto"
- "off"
- "cool"
- "heat"
icon: mdi:air-conditioner
#These are the sliders for setting your heating or cooling target`Preformatted text`
input_number: DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
heating_target:
name: Heating Target
initial: 68
min: 64
max: 72
step: 1
cooling_target:
name: Cooling Target
initial: 76
min: 72
max: 78
step: 1
automation: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
## These two automations make sure the dropdown box and thermostat are always the same no matter where you change it.
- alias: Set Thermostat Mode Selector
trigger:
- platform: mqtt
topic: "smartthings/Thermostat/thermostatMode"
action:
- service: input_select.select_option
data_template:
entity_id: input_select.thermostat_mode
option: '{{ trigger.payload }}'
- alias: Set Thermostat Mode
trigger:
- platform: state
entity_id: input_select.thermostat_mode
action:
- service: mqtt.publish
data_template:
topic: "smartthings/Thermostat/thermostatMode"
retain: true
payload: '{{ states.input_select.thermostat_mode.state }}'
## These two automations make sure the heating slider and thermostat are always the same no matter where you change it.
- alias: Heating target set
trigger:
- platform: mqtt
topic: "smartthings/Thermostat/heatingSetpoint"
action:
- service: input_number.set_value
data_template:
entity_id: input_number.heating_target
value: '{{ trigger.payload}}'
- alias: Set heating target
trigger:
- platform: state
entity_id: input_number.heating_target
action:
- service: mqtt.publish
data_template:
topic: "smartthings/Thermostat/heatingSetpoint"
retain: true
payload: '{{ states.input_number.heating_target.state | int }}'
## These two automations make sure the cooling slider and thermostat are always the same no matter where you change it.
- alias: Cooling target set
trigger:
- platform: mqtt
topic: "smartthings/Thermostat/coolingSetpoint"
action:
- service: input_number.set_value
data_template:
entity_id: input_number.cooling_target
value: '{{ trigger.payload}}'
- alias: Set cooling target
trigger:
- platform: state
entity_id: input_number.cooling_target
action:
- service: mqtt.publish
data_template:
topic: "smartthings/Thermostat/coolingSetpoint"
retain: true
payload: '{{ states.input_number.cooling_target.state | int }}'
group: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
East Hall Thermostat:
- sensor.east_hall_temperature
- sensor.east_hall_humidity
- input_select.thermostat_mode
- switch.east_hall_thermostat_fan_mode
- sensor.east_hall_thermostat_current_state
- input_number.heating_target
- input_number.cooling_target
- sensor.east_hall_thermostat_battery
customize: #DO NOT DUPLICATE (only one of these should be in your configuration.yaml)
switch.east_hall_thermostat_fan_mode:
friendly_name: 'House Fan'
icon: mdi:fan
binary_sensor.bedroom_motion_detector:
google_assistant: false
sensor.east_hall_humidity:
icon: mdi:water-percent
sensor.east_hall_thermostat_battery:
icon: mdi:battery
Thanks for posting this. I’m trying to implement it and am getting the following:
Failed config
General Errors:
- Component not found: cooling_target
- Setup failed for cooling_target: Component not found.
- Component not found: heating_target
- Setup failed for heating_target: Component not found.
found a few things that weren’t working for me…I had to put /state or /cmd at the end of a lot of your topics, but other than that, it’s working like a charm! Now, to find out if I can set auto temperatures based on this…
Yup, I use them in automations and scripts. Piece of advice, never hard code temperatures into automations or scripts. Your comfort zone will fluctuate so it’s best to set defaults up as sliders and then adjust those as your preferences shift. I have a bunch of sliders for default temps whether I’m away, awake, or asleep.
Yup!! I have a fairly wide comfort level put in for now. I’ll have to take a look at scenes and automations later on, but I just wanted to see if this smartthings setup and some sort of auto temperature would play well together.
Hey, I know this is from a while ago now, but can you send me one of those automations you used for generic thermostat? Thought I had it down, apparently I missed something…
@roofuskit I found something I’m trying to fix right now - so the slider works great if it’s the only device you are using to change the temperature, but if you want to use automation, I’ve noticed it doesn’t change…at least, not the way I tried using automation. I also noticed that the thermostat mode selector doesn’t change. My solution is below
Thanks for posting this. I have everything working except setting the heating and cooling targets. The sliders update but for some reason the data does not get published out to the thermostat.