Homeassistant skill misinterprets request


#1

I have a working Homeassistant and have installed the Homeassistant skill on Mycroft. Mycroft appears to communicate with my HA instance. I can manipulate one of my actuators with verbal or typed commands.

I have some other actuators ( reflashed Sonoff with Tasmota ). Since I have four of these, their name on HA are suffixed with the numbers 1-4. The skill seems to get fixated on one particular actuator and ignores the number I actually want to address. This is not a speech recognition problem since a typed command does not work either.

In short “turn on blabla 1” will result in mycroft trying for instance to manipulate “blabla 3”.

Edit
New wrinkle with HA
blabla is currently on

turn off blabla – reply from mycroft “would you like me to turn myself off?”
no
turn on blabla – reply from mycroft “blabla already on”


#2

Hi Robert, thanks for flagging this.

I’ve created an issue for this on the HA Skills repo. This Skill is maintained by our Community-based United Skill Writers team, so I’ll give them a nudge to see who might have time to take a look.


#3

With regard to the second problem reported with an edit to my original post, I think it is entirely a Mycroft problem. When I type in “turn on world” Mycroft contacts HA and HA responds by listing everthing it knows about all the entities configured in HA. Mycroft responds with “Entity world could not be found”

When I type in “turn off world”, Mycroft does not consult HA ( confirmed by network sniffer ). Mycroft reponds with “Confirming: Would you like me to turn myself off?”

Slightly off topic, the entity listing from HA potentially could be huge. It might be good if Mycroft could cache the list for a time. Also add an intent to refresh the HA entities.


#4

HomeAssistant itself is far more mature than our HA Skill so I’m confident you are correct and the issue is in the Skill.

We are currently building out a Common IoT Framework to better handle home automation etc. So flagging issues and potential optimisations like this is really helpful, thanks!


#5

With regard to the issue with numbered entities further testing seems to indicate that Mycroft disregards nubered entities. When Mycroft initiates an action it first requests a status from HA. When HA sends the status message it doesn’t necessarily list numbered entities in order. If it receives the status for blabla 3 first it becomes fixated on that entity. Therefore blabla ( 1 to whatever ) or even blabla on its own is interpreted as blabla 3.


#6

From this and your other thread, it sounds like there’s a bit of work required.

I’ve flagged this with the Skill authors and let them know these threads are here, however they may take some time to address the issues.

Still great to include any further observations you make that might help.


#7

@Robert_Dyck,

This was actually related to a change to the stop skill. The most recent version of the skill should not have this problem, so you may want to try this again (the PR to fix it went in 4 days ago - https://github.com/MycroftAI/skill-stop/pull/30/files - I would expect that you’ve had it automatically updated by now).

I am currently in the process of re-writing the Home Assistant skill to leverage the CommonIOT framework. It is still under development, but if you’d like to test it out, it would be great to get your feedback.

You can install try it out by installing the iot control skill (https://github.com/MycroftAI/skill-iot-control) and the feature/commonIoT branch of the Home Assistant skill (https://github.com/MycroftAI/mycroft-homeassistant/tree/feature/commonIoT).

At the moment, you’ll have to install these via git. This is all still under active development, but it should handle the basics (turning devices on/off, lights up/down, thermostat up/down, and running scripts and automations by name). If you give it a shot, please feel free to provide any feedback you have.

-Chris


#8

Turning off an Homeassistant entity now works again, thankyou.

The problem with numbered entities remains.

As time permits I’ll try out the commonIOT framework.


#9

Python noobie ignorance on display.
I decided to try skill -iot-control. I entered my Mycroft virtual environment and activated it. I tried –

pip3 install git+https://github.com/MycroftAI/skill-iot-control.git Cloning https://github.com/MycroftAI/skill-iot-control.git to /tmp/pip-req-build-65cwvvi0
   Complete output from command python setup.py egg_info:
   Traceback (most recent call last):
     File “<string>”, line 1, in <module>
     File “/usr/lib64/python3.7/tokenize.py”, line 447, in open
       buffer = _builtin_open(filename, ‘rb’)
   FileNotFoundError: [Errno 2] No such file or directory: ‘/tmp/pip-req-build-65cwvvi0/setup.py’

Then I tried –

git clone https://github.com/MycroftAI/skill-iot-control.git

so far so good.

pip3 install skill-iot-control
Collecting skill-iot-control
Could not find a version that satisfies the requirement skill-iot-control (from versions: )
No matching distribution found for skill-iot-control

Some help needed. Thanks


#10

The Skills have to be installed into the /opt/mycroft/skills directory.

The easiest way to install Skills from a github repo is to use:
mycroft-msm install https://github.com/author/skill-repo
This clones the repository into the right directory with the right permissions for you.


#11

The homeassistant specific part as well? ( mycroft-msm install )
Do I need to uninstall the existing homeassistant skill?


#12

You should be able to switch to the common IoT branch by running git fetch && git checkout feature/commonIoT from within the home assistant skill directory (which should be in /opt/mycroft/skills).

Let me know if you’re able to do that successfully, or if you hit issues/have more questions.


#13

I believe I was successful installing skill-iot-control using “mycroft-msm install” as suggested by gez-mycroft. However I have doubts about the second URL you provided. https://github.com/MycroftAI/mycroft-homeassistant/tree/feature/commonIoT

Whether I use mycroft-msm or git directly as you suggested I get
“fatal: repository ‘https://github.com/MycroftAI/mycroft-homeassistant/tree/feature/commonIoT/’ not found”


#14

You shouldn’t actually need that URL for anything - it just links to the correct branch on github if you’d like to look at the code.

To checkout that branch on your Mycroft device (be it a Mark1, picroft, desktop, or other), all you need to do is cd into the homeassistant skill directory, and checkout that branch with git:

cd /opt/mycroft/skills/mycroft-homeassistant* && git fetch && git checkout feature/commonIoT

You should be able to just copy/paste that and have it work. If you hit any issues, check the path in the cd command, and make sure it’s the correct path to put you into the homeassistant skill directory. Let me know if that works for you.


#15

It appears that the HA directory in /opt/mycroft/skills is actualy called homeassistant.mycroftai.

Anyway I should have taken your instructions literally. My previous experience with git was simply to use clone which of course required the URL.

“git fetch” seems to work. I suppose no response is expected.
“git checkout feature/commonIoT” results in “Switched to new branch ‘feature/commonIoT’ from ‘origin’”

I see there a yaml file for settings. Is that accessible from home.mycroft.ai for setting up the API?

Does this branch address my original problem with numbered HA entities? To answer my own question I should just test it.


#16

Yes, the settingsmeta.yaml file should generate a settings card on the website. It should be mostly the same as the old one, with just two additions, if I recall correctly.

The intent handling is entirely new, and I believe it will resolve your issue. Let me know if it works.

-Chris


#17

It’s not working for me when I use branch feature/commonIoT. As an aside, how does one capture the logs?

The homeassistant skill is not loading when Mycroft is started.
from log –

mycroft.skills.core:remove_fallback:1792 - Warning could not remove fallback!
mycroft.skills.core:load_skill:168 -ERROR - Failed to load skill: homeassistant.mycroftai


#18

As an aside, how does one capture the logs?

Can you clarify what you’re asking here? It looks like you found some of the logs, and were able to copy/paste them out, so I’m not sure what you’re looking for.

Can you look for where it tries to first load the skill? If you search /var/log/mycroft/skills.log from the top for homeassistant, there should be a stack trace, with a message about why it failed to load.


#19

That’s what I needed. - /var/log/mycroft etc. The debug screen was very difficult to copy anything.

3:47:36.341 - mycroft.skills.core:load_skill:121 - INFO - ATTEMPTING TO LOAD SKILL: homeassistant.mycroftai with ID
homeassistant.mycroftai
13:47:36.454 - mycroft.skills.core:remove_fallback:1792 - WARNING - Could not remove fallback!
13:47:36.460 - mycroft.skills.core:load_skill:168 - ERROR - Failed to load skill: homeassistant.mycroftai
Traceback (most recent call last):
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/connection.py”, line 159, in _new_conn
   (self._dns_host, self.port), self.timeout, **extra_kw)
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/util/connection.py”, line 80, in create
_connection
   raise err
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/util/connection.py”, line 70, in create
_connection
   sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Followed by –

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/connectionpool.py”, line 600, in urlope
n
   chunked=chunked)
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/connectionpool.py”, line 354, in make
request
   conn.request(method, url, **httplib_request_kw)
 File “/usr/lib64/python3.7/http/client.py”, line 1244, in request
   self._send_request(method, url, body, headers, encode_chunked)
 File “/usr/lib64/python3.7/http/client.py”, line 1290, in _send_request
   self.endheaders(body, encode_chunked=encode_chunked)
 File “/usr/lib64/python3.7/http/client.py”, line 1239, in endheaders
   self._send_output(message_body, encode_chunked=encode_chunked)
 File “/usr/lib64/python3.7/http/client.py”, line 1026, in _send_output
   self.send(msg)
 File “/usr/lib64/python3.7/http/client.py”, line 966, in send
   self.connect()
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/connection.py”, line 181, in connect
   conn = self._new_conn()
 File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/connection.py”, line 168, in _new_conn
   self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fcf9c0397b8>: Failed to estab
lish a new connection: [Errno 111] Connection refused


#20

Hmm… strange. Are all your other skills working? And does this still work on the 19.02 branch (git checkout 19.02)?

I don’t see anything in that stacktrace that actually points to the homeassistant skill - it stops at a core python file:

File “/home/rdyck/mycroft-core/.venv/lib64/python3.7/site-packages/urllib3/util/connection.py”, line 70

Typically, I would expect the trace to show me where in the skill itself the issue occurred.

If I had to guess based just on this, and assuming all the other skills are working, it’s probably having trouble connecting to homeassistant. You might double check that homeassistant is up and running, and that the hostname and port are correct in the config.