This skill is made for Picroft Lightning which is Picroft on Rasbian stretch and should install and initialize “out of the box”.
If you are running another installation of Mycroft and the skill isnt initialize properly, it could be that the mycroft user dont have access to the GPIO which is needed to control led and button. You then need to add the mycroft user to the gpio group with the command
sudo usermod -g gpio mycroft
How to test SKILL NAME
Does it install ?
Does ligt turn on when saying Hey Mycrof ?
Shortpress get him listing
Longpress gets hi stopping whatever he is dooing
Where feedback on SKILL NAME should be directed a
Please give feedback here or open a issue on GitHub.
I have a suggestion to make the kit more responsive. I have noticed that very quick ‘taps’ are often missed and have to be repeated 2 or 3 times in order to register. This is expected using the 100 ms polling that you are doing. I made a lame 2-line change that seems to fix this as shown below:
def handle_button(self, message):
longpress_threshold = 2
**if GPIO.event_detected(BUTTON):**
self.log.info("GPIO.event_detected")
pressed_time = time.time()
while not GPIO.input(BUTTON):
time.sleep(0.2)
pressed_time = time.time() - pressed_time
if pressed_time < longpress_threshold:
self.bus.emit(Message("mycroft.mic.listen"))
else:
self.bus.emit(Message("mycroft.stop"))
Is there some reason why you relied on polling rather than GPIO event detect? Although my fix seems to work, I heard some oddly random vocal nonsense out of the speaker when I rebooted my AIY enclosure. Later, when I tried to reproduce it, it was gone.
Hi @randalgay
The reason - I beleave - is that this is one of my first skills and I have learned a lot sinse. Ill ge bak to the skill soon and look at it again and having your suggestions in mind.
Great! I know the feeling since I am working on my first skill myself. I was just wondering if you had tried other methods and abandoned them due to side effects that they were causing in other parts of the system. I tried a more ambitious fix using a GPIO event handler and it did not work at all. The code seemed to be right, but the event was not firing as it should. Not worth pursuing if this works as expected.