I can show this as an entity in Lovelace, but I am unsure how to call a service depending on the state of this - i’m not great with scripts etc.
Basically, if the state is changed, it needs to call a service where one of the attributes is the state
# This automation script runs when the thermostat mode selector is changed.
# It publishes its value to the same MQTT topic it is also subscribed to.
- alias: "Set Thermostat Mode"
trigger:
platform: state
entity_id: input_select.thermostat_mode
action:
service: mqtt.publish
data:
topic: "thermostatMode"
retain: true
payload: "{{ states('input_select.thermostat_mode') }}"
Stopped because an error was encountered at 16 August 2021, 11:23:04 (runtime: 0.02 seconds)
value must be one of ['locked_all', 'locked_in', 'locked_out', 'unlocked'] for dictionary value @ data['lock_state']