as a workaround - i might try and make my HA shell_commands read the successful "OK!"and try again on failure or at least show an error to the user.
I have updated the script.js to have a ok/error check via mqtt. Every time you call the bot, it will either have ok or error message output to mqtt.
From there you can create a sensor and use it to re run the bot if it outputs error. You will need to think how you can implement this check for all your bots. I was testing it on the bot device using script. Seems to work. The below script template will run 10 times or until until sensor.switchbot_status state is ok.
script.yaml
switchbot_bot_enable:
sequence:
- repeat:
until:
- condition: or
conditions:
- condition: template
value_template: "{{ is_state('sensor.switchbot_status', 'ok') }}"
- condition: template
value_template: "{{ repeat.index % 10 == 0 }}"
sequence:
- service: switch.turn_{{ mode }}
data:
entity_id: '{{ bot }}'
automation.yaml
- alias: 'turn on 24hr fan'
trigger:
platform: time
at: '05:30:00'
condition:
- condition: template # Not on Vacation
value_template: "{{ not is_state('input_select.home_mode', 'Vacation') }}"
- condition: template # Someone is home
value_template: "{{ not is_state('input_select.home_mode', 'Away') }}"
action:
- service: script.switchbot_bot_enable
data:
mode: 'on'
bot: switch.24hr_fan_bot
- alias: 'turn off 24hr fan'
trigger:
platform: time
at: '23:00:00'
condition:
- condition: template # Not on Vacation
value_template: "{{ not is_state('input_select.home_mode', 'Vacation') }}"
- condition: template # Someone is home
value_template: "{{ not is_state('input_select.home_mode', 'Away') }}"
action:
- service: script.switchbot_bot_enable
data:
mode: 'off'
bot: switch.24hr_fan_bot
sensor.yaml
- platform: mqtt
name: 'Switchbot Status'
state_topic: 'switchbot/status/msg'
value_template: '{{ value }}'