Mycroft Community Forum

Mycroft speaks twice with HomeAssistant confirmations

With HomeAssistant skill:

Recently got HomeAssistant up and running. It’s great! I really like it, and it makes the Mycroft much more useful with the range of integrations. However, when asking Mycroft to set the thermostat on my ecobee thermostat to %temperature, it does so…then tells me twice.

“Successfully set thermostat to 70 none, successfully set thermostat to 70 none”. (Side note: 70 none? Why the “none”? Is that for tenths of a degree? That needs to go away…I do not need my thermostat to care about tenths of a degree.)

[0:02] Decoding of 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 finished.
2021-10-27 12:34:51.320 | INFO | 20027 | mycroft.audio.speech:mute_and_speak:127 | Speak: Successfully set Thermostat to 70 None.
2021-10-27 12:34:51.325 | INFO | 20027 | mycroft.tts.tts:_get_sentence_from_cache:407 | Found 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 in TTS cache
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.25.10; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes

Directory: /tmp/mycroft/cache/tts/PollyTTS/
Playing MPEG stream 1 of 1: 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 …

MPEG 2.0 L III cbr48 22050 mono

2021-10-27 12:34:51.611 | INFO | 20027 | mycroft.audio.speech:mute_and_speak:127 | Speak: Successfully set Thermostat to 70 None.
2021-10-27 12:34:51.617 | INFO | 20027 | mycroft.tts.tts:_get_sentence_from_cache:407 | Found 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 in TTS cache

[0:02] Decoding of 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 finished.
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.25.10; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes

Directory: /tmp/mycroft/cache/tts/PollyTTS/
Playing MPEG stream 1 of 1: 8759b211db1e9dcfe6f4fbe9febb7ef4.mp3 …

MPEG 2.0 L III cbr48 22050 mono

Would be pretty nice if I wanted to hear it twice…but I don’t. I do not see an obvious thing in the logs. I did try disabling entities with “thermostat” in their name in HomeAssistant, because maybe it was matching the name up and trying to set the temp on two thermostats, but that didn’t fix it. Screenshot attached, any advice would be very much appreciated.

Side note: I’m really in awe of how great the combination of HomeAssistant and Mycroft is. It’s fabulous. If anyone remembers the bad old days of X10…this is loads better.

1 Like

Hey Sparky,

There’s some pretty active work going on in the HomeAssistant Skill at the moment.

I believe the “None” is referring to a unit of measure that wasn’t getting returned correctly, and I believe a fix is in the works.

Not sure why the dialog is duplicated though. I’ll flag it in the Skill repo and hopefully someone has time to take a look shortly.

Thanks for the detailed outline of the issue and really great to hear you’re liking the combination of HA and Mycroft!

2 Likes

Hi @sparkyvision, Just to clarify, You want to interact with climate.thermostat?

Also which version if HA skill do you run? Is it actual branch 20.08 from GitHub or one installed from marketplace?

Could You share more information about your your thermostat? Ideally screen shot from developer tools in HA.

Hello @Tony763! Thanks for replying.

To clarify, yes, I’d like to interact with climate.thermostat. I installed it from the Marketplace, is that the incorrect way to do it? (Is there a better way to know what version is installed? I’m poking around in the files in the skills directory and not seeing a ver=20.08 or anything like that anywhere.)

Attached is a screenshot showing climate.thermostat, let me know if that’s not what you’re after.

It’s absolute correct to install from Marketplace, however for Home Assistant skill Marketplace contain outdated version as there is conflict with where is skill, so latest changes are blocked. I proposed PR #89 for fixing it. Your second error with None should be already fixed. Latest build also contain another bug made by me (what a shame) but fix is also proposed as PR #86. It wait’s for test run as I prepared new test suite based on Github Actions. It had some birth pains but should be working now. I hope @gez-mycroft will have time soon to check them. This month must had been busy for him as there was really lot of development in HA skill. For two time response, I did not see this occur in latest code so when those bug fix got approve and merge, I will let You know and ask You to test it again. Hope it will be soon.

1 Like

Hi @sparkyvision, PR #86 was merged so if You want, You can test latest version of HA skill from GitHub.

I would do that via a git pull in the HomeAssistant directory, yeah?

Yes, that’s also way, You have to remove old skill and run mycroft-pip install -r requirements.txt from new clonned dir.

msm update https://github.com/MycroftAI/skill-homeassistant.git should do the trick.

You’d think so, wouldn’t you? But it claims to not be installed.

INFO - building SkillEntry objects for all skills
INFO - Problem performing action. Restoring skill to previous state...
NotInstalled: skill-homeassistant is not installed

[Edit] I searched for and removed the “homeassistant” skill via msm list , then did a msm install https://github.com/MycroftAI/skill-homeassistant.git , which completed successfully. However, I’m still waiting for the thingy to appear in my skills listing at Account.

[Edit 2] franticly mashes CTRL+R

Do you get any errors in the skills.log ? Like something like this:

  File "/home/mycroft/core/mycroft/skills/skill_loader.py", line 307, in _create_skill_instance
    self.instance.initialize()
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 93, in initialize
    self._setup()
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 34, in _setup
    ip_address = check_url(self.settings.get('host'))
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/ha_client.py", line 53, in check_url
    matches = re.findall(IPV6_REGEX, ip_address)
  File "/usr/lib/python3.7/re.py", line 223, in findall
    return _compile(pattern, flags).findall(string)
TypeError: expected string or bytes-like object

Why yes, as a matter of fact.

2021-10-29 08:46:42.181 | INFO     | 28731 | mycroft.skills.skill_loader:load:185 | ATTEMPTING TO LOAD SKILL: skill-homeassistant.mycroftai
2021-10-29 08:46:42.553 | INFO     | 28731 | mycroft.skills.settings:get_local_settings:83 | /opt/mycroft/skills/skill-homeassistant.mycroftai/settings.json
2021-10-29 08:46:42.555 | INFO     | 28731 | mycroft.skills.settings:get_local_settings:83 | /opt/mycroft/skills/skill-homeassistant.mycroftai/settings.json
2021-10-29 08:46:42.642 | INFO     | 28731 | HomeAssistantSkill | Removing all handlers...
2021-10-29 08:46:42.646 | WARNING  | 28731 | mycroft.skills.fallback_skill:remove_fallback:185 | Could not find matching fallback handler
2021-10-29 08:46:42.659 | ERROR    | 28731 | mycroft.skills.skill_loader:_create_skill_instance:313 | Skill initialization failed with TypeError('expected string or bytes-like object')
Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/skill_loader.py", line 307, in _create_skill_instance
    self.instance.initialize()
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 93, in initialize
    self._setup()
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/__init__.py", line 34, in _setup
    ip_address = check_url(self.settings.get('host'))
  File "/opt/mycroft/skills/skill-homeassistant.mycroftai/ha_client.py", line 53, in check_url
    matches = re.findall(IPV6_REGEX, ip_address)
  File "/usr/lib/python3.7/re.py", line 223, in findall
    return _compile(pattern, flags).findall(string)
TypeError: expected string or bytes-like object
2021-10-29 08:46:42.685 | ERROR    | 28731 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill skill-homeassistant.mycroftai failed to load
2021-10-29 08:46:46.797 | INFO     | 28731 | mycroft.skills.intent_services.padatious_service:train:81 | Training... (single_thread=False)
Regenerated skill-homeassistant.mycroftai:cover.open.intent.
Regenerated skill-homeassistant.mycroftai:set.climate.intent.
Regenerated skill-homeassistant.mycroftai:toggle.intent.
Regenerated skill-homeassistant.mycroftai:set.light.brightness.intent.
Regenerated skill-homeassistant.mycroftai:increase.light.brightness.intent.
Regenerated skill-homeassistant.mycroftai:automation.intent.

There is that.

[Edit] Formatting.

1 Like

I’m having the same error. @Tony763 is aware about this and will try to look into it.

1 Like

could you clone my repo Tony763/skill-homeassistant and switch to branch patch-8. I put some debbuging there (did on phone but CI claims it works) an post output here?

You know, one of these days I’ll get around to Googling “how does git work” but until then, uh…do what now?

Apologies for being an ignoramus.

remove old skill,

msm install https://github.com/Tony763/skill-homeassistant.git

, cd skill-homeassistant git checkout patch-8, restart mycroft

Same error with branch patch-8

mycroft@mycroft_skills:/opt/mycroft/skills/skill-homeassistant.tony763$ git branch
  github-actions
* patch-8

yes it will be, i just put debug inside so I need a log output, there should be two lines: type and content. As I cannot reproduce this error, I need this output from your instances

I had to add str() to ip_address to make it loads. Here is the diff:

diff --git a/ha_client.py b/ha_client.py
index 3f3c881..e8862f0 100644
--- a/ha_client.py
+++ b/ha_client.py
@@ -50,7 +50,7 @@ def check_url(ip_address):
     If nothing found, second regex try to find IPv4 and domains names.
     """
     valid = False
-    matches = re.findall(IPV6_REGEX, ip_address)
+    matches = re.findall(IPV6_REGEX, str(ip_address))
     if matches:
         largest = max(matches, key=len)[0]
 
@@ -65,7 +65,7 @@ def check_url(ip_address):
             if largest and valid:
                 return largest
 
-    matches = re.search(IP_REGEX, ip_address)
+    matches = re.search(IP_REGEX, str(ip_address))
     if matches:
         return matches.group(1)
     return None

EDIT 1:

But now I got this:

2021-10-29 14:26:03.479 | ERROR    |     1 | HomeAssistantSkill | type: <class 'str'>
2021-10-29 14:26:03.479 | ERROR    |     1 | HomeAssistantSkill | content:

EDIT 2:

Seems to just be a debug message, because in settings.json I got the configuration from the UI.

{"__mycroft_skill_firstrun": false, "ssl": false, "host": "http://192.168.1.9", "token": "XXXXX", "verify": false, "portnum": 8123, "enable_fallback": true}`

EDIT 3:

It’s working. :heart_eyes:

I’m attempting to remove the old skill, however I’m running into the MultipleSkillMatches error. I don’t see a command line switch in the documentation to force one or the other, and the two skills are identically named “homeassistant”. Thoughts?

I could just blow away the dirs, but I assume msm does stuff to configuration files and I don’t want those to have dirty uninstall information in them.