Hi All - Brand new today to Home Assistant. I have made some great progress, but am running into 1 issue that I just cant seem to fathom.
My AO Smith integration works in Home Assistant. There is a feature on it that is “away mode”, and this can be turned on and off successfully.
The issue that I have is that this is not exposed to HomeKit. So, I have created a custom script that toggles the setting on or off depending on the current state. The script is here:
alias: Toggle Away Mode
sequence:
- choose:
- conditions:
- condition: state
entity_id: water_heater.water_heater
state: "on"
attribute: away_mode
sequence:
- data:
away_mode: false
action: water_heater.set_away_mode
target:
device_id: c4f9180954e72d142924cf68d5d09b30
entity_id: water_heater.water_heater
- data:
name: Set Water Heater Away Mode
message: The script completed successfully.
entity_id: script.water_heater_normal_mode
action: logbook.log
alias: Water Heater On
- conditions:
- condition: state
entity_id: water_heater.water_heater
state: "off"
attribute: away_mode
sequence:
- data:
away_mode: true
action: water_heater.set_away_mode
target:
device_id: c4f9180954e72d142924cf68d5d09b30
entity_id: water_heater.water_heater
- data:
name: Set Water Heater Away Mode
message: The script completed successfully.
entity_id: script.water_heater_normal_mode
action: logbook.log
alias: Water Heater Off
This script works perfectly when I run the action from Home Assistant. In home kit, the script appears as a switch. The switch does not work though. I turned on debug in Home Assistant, and I do see 2 logs that show that the script is being called:
2025-01-26 21:02:07.055 DEBUG (MainThread) [homeassistant.components.homekit.type_switches] script.water_heater_normal_mode: Set switch state to True
2025-01-26 21:02:17.058 DEBUG (SyncWorker_9) [homeassistant.components.homekit.type_switches] script.water_heater_normal_mode: Reset switch to off
From what I understand this is normal activity and shows that the script is being called.
However, nothing happens. The switch in HomeKit just reverts to off, and the water heater does not change state.
I have also run the script from ACTIONS in Developer tools. It functions perfectly from there and the water heater changes state, but again, fails when I try from Homekit.
Does anyone have any pointers for me on where I can look next?
Cheers