MycroftAI / skill-homeassistant

Mycroft Skill/Integration for Homeassistant
GNU Lesser General Public License v3.0
114 stars 62 forks source link

Skill crash when speaking an error about HA setup #121

Open Ramblurr opened 1 year ago

Ramblurr commented 1 year ago

This line is missing arguments for the dialog: https://github.com/MycroftAI/skill-homeassistant/blob/19c1b010bed5306d4857a70de05ca2fa40bdfaa0/__init__.py#L155

==> /var/log/mycroft/skills.log <==
2023-01-11 15:09:55.699 - skills - mycroft.skills.intent_services.commonqa_service:_query_timeout:173 - INFO - Timeout occurred check responses
2023-01-11 15:09:55.924 - skills - mycroft.skills.mycroft_skill.mycroft_skill:_on_event_error:1131 - ERROR - 'field'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/ovos_utils/messagebus.py", line 352, in wrapper
    handler(message)
  File "/home/mycroft/.local/share/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 229, in handle_turn_on_intent
    self._handle_turn_actions(message)
  File "/home/mycroft/.local/share/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 382, in _handle_turn_actions
    ha_entity = self._find_entity(
  File "/home/mycroft/.local/share/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 155, in _find_entity
    self.speak_dialog('homeassistant.error.setup')
  File "/usr/lib/python3.10/site-packages/mycroft/skills/mycroft_skill/mycroft_skill.py", line 1490, in speak_dialog
    self.dialog_renderer.render(key, data),
  File "/usr/lib/python3.10/site-packages/ovos_utils/dialog.py", line 94, in render
    line = line.format(**context)
KeyError: 'field'

The dialog expects a field argument, but this line does not pass any.

Tony763 commented 1 year ago

Hi @Ramblurr, great catch.

Line 155 and 825 should rather use homeassistant.error.offline.dialog as they are after setup stage a rather check if HA instance was initialized/comunicate.

I will check it properly tonight and prepare PR.