mycroft-skills icon indicating copy to clipboard operation
mycroft-skills copied to clipboard

Add skill-iot-control

Open ChristopherRogers1991 opened this issue 5 years ago • 9 comments

Info

This PR adds the new skill, skill-iot-control, to the skills repo.

Description

This Skill doesn't do anything by itself, but it provides an important common language for controlling Internet of Things (IoT) or Smart Home devices. By handling simple phrases like 'turn on', this one Skill can unify multiple other Skills that act as the interface into specific IoT devices or control ecosystems. This creates uniform and seamless interactions for the user!

Created with mycroft-skills-kit v0.3.13

ChristopherRogers1991 avatar Jun 12 '19 00:06 ChristopherRogers1991

https://github.com/MycroftAI/mycroft-core/pull/2150 on core will need to go in before this (to get the State enum).

ChristopherRogers1991 avatar Jun 12 '19 00:06 ChristopherRogers1991

run test

krisgesling avatar Jun 21 '19 02:06 krisgesling

I'm not familiar with this syntax and it's throwing a syntax error on my machine, preventing the skill from loading at all: self.speech_requests: DefaultDict[str, List[SpeechRequest]] = defaultdict(list)

I'm assuming this is also why Jenkins can't run.

krisgesling avatar Jun 21 '19 05:06 krisgesling

@krisgesling,

Those are type hints. I have used them in some places in mycroft core, but this may be the first time I've submitted a skill that had them. Assuming this runs against the same versions of Python as Mycroft core (from the trace below, it looks like it's 3.6, which should support them), I wouldn't expect that to be the issue here.

Looking at the test output, I see:

ATTEMPTING TO LOAD SKILL: skill-iot-control.mycroftai with ID test-skill-iot-control.mycroftai
Failed to load skill: skill-iot-control.mycroftai
Traceback (most recent call last):
  File "/app/mycroft-core/mycroft/skills/core.py", line 128, in load_skill
    imp.PY_SOURCE))
  File "/usr/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/mycroft/skills/skill-iot-control.mycroftai/__init__.py", line 26, in <module>
    from mycroft.skills.common_iot_skill import \
ImportError: cannot import name 'Attribute'

So it looks like the issue here is actually that this is running against 19.02, but it needs features from dev. I expected this to run against dev (hence the comment about https://github.com/MycroftAI/mycroft-core/pull/2150 needing to be merged first), but am realizing now I was forgetting how this process is intended to work.

I suppose this has to sit until testing for the release begins?

-Christopher

ChristopherRogers1991 avatar Jun 21 '19 11:06 ChristopherRogers1991

Run test

forslund avatar Jul 05 '19 15:07 forslund

:champagne: :tada:

krisgesling avatar Jul 05 '19 16:07 krisgesling

Worth noting, the Mark-1 is still on python 3.4 and could possibly have issues with the type hints. So would be best to check that platform explicitly. Though if it's the same that are used in core they should be supported.

forslund avatar Jul 05 '19 16:07 forslund

If I'm not mistaken this will require Python 3.6, it seems to be a variable annotation defined in PEP 526

krisgesling avatar Jul 24 '19 04:07 krisgesling

It looks like the only place in core that I also put type hints is https://github.com/MycroftAI/mycroft-core/blob/dev/mycroft/skills/common_iot_skill.py, which isn't used/won't be used until this skill goes in, which is probably how it's managed to slide in without impacting anything yet. For the 3.4 support, we'll probably have to pull the hints out from that file, as well as from this skill.

ChristopherRogers1991 avatar Jul 28 '19 02:07 ChristopherRogers1991