Homeassistant skill misinterprets request


#41

I appreciate the difficulty. Mycroft is more one-way oriented than Homeassistant and its ilk. HA is all about knowing the status of the devices it is responsible for. With Mycroft the onus is on the human to be aware of the status of the entities. It wouldn’t make sense to ask Mycroft to turn on the office light when you know it is already on. However it not difficult to dream up situations where the human didn’t know the current status. The ability to query an entitie’s status whether it is a sensor or a switch would be useul.

The beauty of MQTT ( here I go again ), is that one simply subscribes to a “TOPIC”, that is to say the entity plus its status. The subscribers could be a full on home automation system, a remote dashboard, or a generic app on your phone.

This has been interesting and I’ll try to keep up with the development of Mycroft, especially as it relates to IOT.


#42

is .yaml going to be the new standard? Is .json defunct?


#43

JSON is dead, long live JSON

JSON isn’t going anywhere and that includes in Mycroft. settingsmeta.json files etc will continue to be supported, we are just supporting yaml as well.


#44

sorry to jump in on this thread, I am attempting to get the Home Assistant skill up and running too. I had issues with devices with similar names being confused with each other.

“Turn on the lounge lights” would get picked up as “turn on the lounge lamp” for example. Similar to what is described in the opening comment.

I decided to switch to the CommonIOT branch and install the common IOT platform. Both unfortunately throw errors:

14:29:01.522 - mycroft.skills.core:load_skill:169 - ERROR - Failed to load skill: homeassistant.mycroftai

Traceback (most recent call last):

File "/opt/mycroft/mycroft/skills/core.py", line 131, in load_skill

imp.PY_SOURCE))

File "/usr/lib/python3.5/imp.py", line 234, in load_module

return load_source(name, filename, file)

File "/usr/lib/python3.5/imp.py", line 172, in load_source

module = _load(spec)

File "<frozen importlib._bootstrap>", line 693, in _load

File "<frozen importlib._bootstrap>", line 673, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 661, in exec_module

File "<frozen importlib._bootstrap_external>", line 767, in get_code

File "<frozen importlib._bootstrap_external>", line 727, in source_to_code

File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed

File "/opt/mycroft/skills/homeassistant.mycroftai/__init__.py", line 149

self._client: HomeAssistantClient = None

and

14:29:10.583 - mycroft.skills.core:load_skill:169 - ERROR - Failed to load skill: skill-iot-control.mycroftai
Traceback (most recent call last):
  File "/opt/mycroft/mycroft/skills/core.py", line 131, in load_skill
    imp.PY_SOURCE))
  File "/usr/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 661, in exec_module
  File "<frozen importlib._bootstrap_external>", line 767, in get_code
  File "<frozen importlib._bootstrap_external>", line 727, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/opt/mycroft/skills/skill-iot-control.mycroftai/__init__.py", line 63
    self.speech_requests: DefaultDict[str, List[SpeechRequest]] = defaultdict(list)
                        ^

Any tips on how I might navigate this would be greatly appreciated.


#45

Hey Scott,

It appears to be a problem with the type hinting syntax that hasn’t been used in Mycroft before. We’ve run into some trouble with it on systems still running Python 3.4 but from your output it looks like it’s using 3.5.

If you’re still getting the same error it would be useful to get a broader snippet of your skills.log

If you’re happy to share it you can run:
cat /var/log/mycroft/skills.log | nc termbin.com 9999
This will upload the log file to termbin and return a url for it.


#46

Thanks for the reply @gez-mycroft. Logs have been uploaded here: https://termbin.com/znbf

There looks to be quite a few errors in the older logs. The merge conflict started when I switched branches on the Home Assistant skill.

Let me know if I can provide any other information to help.


#47

Ah my bad, I think it’s actually a variable annotation rather than a standard type hint.

These were defined in PEP 526 and were introduced in Python 3.6. So you will get a syntax error on anything < Python 3.6.

We will need to decide how we handle this before it gets merged into the Marketplace…