[closed] Picroft + Google Voice AIY : button & light

Hi @andlo,
thanks for quick response, now the skill installs without error, …, but another one followed:

mycroft.skills.core:load_skill:159 - ERROR - Failed to load skill: picroft-google-aiy-voicekit-skill.andlo Traceback (most recent call last): File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/core.py", line 143, in load_skill raise e File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/core.py", line 139, in load_skill skill.initialize() File "/opt/mycroft/skills/picroft-google-aiy-voicekit-skill.andlo/__init__.py", line 21, in initialize GPIO.setup(25,GPIO.OUT) RuntimeError: No access to /dev/mem. Try running as root!

after some research on the error message I found out that user mycroft must be member in usergroups for the devices it tries to access. In the end following helped:

sudo usermod -aG kmem mycroft
sudo usermod -aG gpio mycroft

After reboot now the LED lights up when Mycroft is listening, pressing button short makes Mycroft listen and pressing long makes it stop speaking. Fantastic work!

Unfortunately now I can no longer control volume (by volume-skill, alsamixer stills works). I should add that my AIY-PiCroft is running Debian-Jessie and is somewhat “broken” as this is my developement and testing device, so it is probably my installation and not your skill causing the problem…

Thanks for the input.

I am running the Picroft Strech image, and dont have same issues. So it is relatet to your “special” installation or the old jessie picroft.
I cant see why it should do anything regarding volume-skill though. That is strange.

Hi @andlo,

Thank you for this work.
I installed your skill and got this ;

pi@picroft:~ $ msm install GitHub - andlo/picroft-google-aiy-voicekit-skill: Enables google aiy voicehat button
INFO - Downloading skill: GitHub - andlo/picroft-google-aiy-voicekit-skill: Enables google aiy voicehat button
INFO - Installing requirements.txt for picroft-google-aiy-voicekit-skill
INFO - Successfully installed picroft-google-aiy-voicekit-skill

As nothing seemed working, I looked to the logs and find nothing, but I was thinking to add
“LOGGER = getLogger(_name_)” somewhere to keep track of the skill.

Following Dominik’s post I checked the skills.log and found the same error during installation:

20:16:24.491 - mycroft.skills.core:load_skill:159 - ERROR - Failed to load skill: picroft-google-aiy-voicekit-skill.andlo
Traceback (most recent call last):
. File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/core.py”, line 143, in load_skill
raise e
. File “/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/core.py”, line 139, in load_skill
skill.initialize()
. File “/opt/mycroft/skills/picroft-google-aiy-voicekit-skill.andlo/init.py”, line 21, in initialize
GPIO.setup(25,GPIO.OUT)
RuntimeError: No access to /dev/mem. Try running as root!

I copied sudo intructions from Dominik and it works well but for the volume I didn’t check it.

Thanks :slight_smile: I amhappy to hear that it works - and proud that I actually did make a skill that seems to work :slight_smile: I have been reading a lot of stuff and did look at a lot of code to figure out how to get there.

Are you @henridbr using Picroft Strech or Jessie or a self made Mycroft installation?

I do not see the No access to /dev/mem error on my picrofts. But that could be that picroft is running whith root pivileges and that is not normal rasbian way. I am using a stock picroft strech installation.

I will add some logging if I can, but right now I cant figure out how to fix No access to /dev/mem in the skill installation :frowning: Would be glad if someone did know how to do that.

Hi @andlo, @Dominik, @j1nx

I am also following the track of @tjoen’s files because I have begun by his disk image.
Picroft has been updated to 18.8.3 during reboots.
I saved an image of my SD card in order to start on this basis every time I need it.

The button and light issues are linked to the python environment which is under python 2 and python 3.

Right now the button and light are working well after:

  1. installing python3 version of Websocket and RPi.GPIO:
  • sudo mycroft-pip install websocket-client==0.32.0
  • sudo pip3 install RPi.GPIO
  1. modifying mbus.py, button.py and lights.py to work under python3. The changes are:
  • print"" to print()
  • python to python3
  1. modifying custom_setup.sh. Change python to python3

At this point, the led is always pulsing quickly instead of off when nothing occurs.
To fix that I modified my_led_state to (LED_OFF).

The 3 files are on Githubgist there

Now it’s working, and after spending time trying to understand things I have never seen before, I am thinking about python3 which could be the default. I don’t know.

Fun fact: I let my AIY-Picroft sit as it was over night, the next morning volume-skill works again…
So now I have LED+Button+Volume control working.