Open 1337haXXor opened 4 years ago
Hello @1337haXXor,
Does this happen when you trigger the routine manually, when it runs automatically on the schedule, or both?
-Chris
Either way, I never even got to the schedule part.
Just realized I missed that sentence on my first read through - looks like it was a manual trigger. I'll dig through the logs when I have some time, and see if I can get to the bottom of it.
Awesome, thanks for the quick look!
If you need any more info, the install is fairly standard. Pi4, the newest Mycroft (as of a week or two ago?), I've only installed a few skills and tried tinkering around with it. I'm having a couple other issues, so I'm not sure if they're related. Sometimes Mycroft stops speaking audibly. According to the cli, it hears my request, processes it, and even responds, but the response is not audible. Speaker works because I hear the listening chime. Not sure if that's related, but just figured I'd share it in the off chance they're connected.
Ok, I'm pretty sure the primary issue here is that the name of the routine ("morning") appears in the first command of the routine ("say good morning everybody"). I believe Mycroft is picking that up, and trying to run the routine again, which says morning again, and so on...
In theory the intent parser shouldn't match on that, but 'morning' and 'say' are both one word matches, so I don't think there's a ton that can be done (and the intent parser is all beyond the scope of this skill, since that's core mycroft).
I would recommend that you either change the first command, or rename the routine. The routine names should require an exact match, so in theory something as simple as renaming the routine to 'morning time' would be sufficient - if you still have issues, you could try something entirely different, like 'start my day.'
Aside from that, it's unhappy with your schedule:
2020-09-01 16:22:18.641 | ERROR | 605 | mycroft.skills.skill_loader:_create_skill_instance:286 | Skill initialization failed with ValueError('Wrong number of fields; got 3, expected 5')
Traceback (most recent call last):
File "/home/pi/mycroft-core/mycroft/skills/skill_loader.py", line 280, in _create_skill_instance
self.instance.initialize()
File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 66, in initialize
self._register_routines()
File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 135, in _register_routines
self._register_routine(routine)
File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 141, in _register_routine
self._schedule_routine(name, schedule)
File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 144, in _schedule_routine
trigger = CronTrigger.from_crontab(cronstring)
File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/apscheduler/triggers/cron/__init__.py", line 100, in from_crontab
raise ValueError('Wrong number of fields; got {}, expected 5'.format(len(values)))
ValueError: Wrong number of fields; got 3, expected 5
The schedule string is parsed by this function: https://github.com/agronholm/apscheduler/blob/028506a816c74ee05951717c0e45d2e6ad32773e/apscheduler/triggers/cron/__init__.py#L85-L103
There's unfortunately not a ton of documentation there, but basically it needs a cron-like string. If you want it to go off at 8am every day, 0 8 * * 0,1,2,3,4,5,6
or 0 8 * * *
should work (those should be equivalent - 0th minute, 8th hour, every day, every month, every day of the week).
One other caveat with scheduling - I never added logic to handle timezones. It's been a while since I've scheduled anything - it might default to UTC, so just be aware of that, and adjust the hour as necessary.
Let me know if that resolves your issue..
You can look at my Mycroft Scripts on Github. I had a similar issue with repeating routines, but I solved it in a different way. Each routine starts with "stop" before the next line.
On September 2, 2020 6:53:59 PM CDT, ChristopherRogers1991 notifications@github.com wrote:
Ok, I'm pretty sure the primary issue here is that the name of the routine ("morning") appears in the first command of the routine ("say good morning everybody"). I believe Mycroft is picking that up, and trying to run the routine again, which says morning again, and so on...
In theory the intent parser shouldn't match on that, but 'morning' and 'say' are both one word matches, so I don't think there's a ton that can be done (and the intent parser is all beyond the scope of this skill, since that's core mycroft).
I would recommend that you either change the first command, or rename the routine. The routine names should require an exact match, so in theory something as simple as renaming the routine to 'morning time' would be sufficient - if you still have issues, you could try something entirely different, like 'start my day.'
Aside from that, it's unhappy with your schedule:
2020-09-01 16:22:18.641 | ERROR | 605 | mycroft.skills.skill_loader:_create_skill_instance:286 | Skill initialization failed with ValueError('Wrong number of fields; got 3, expected 5') Traceback (most recent call last): File "/home/pi/mycroft-core/mycroft/skills/skill_loader.py", line 280, in _create_skill_instance self.instance.initialize() File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 66, in initialize self._register_routines() File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 135, in _register_routines self._register_routine(routine) File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 141, in _register_routine self._schedule_routine(name, schedule) File "/opt/mycroft/skills/mycroft_routine_skill.christopherrogers1991/__init__.py", line 144, in _schedule_routine trigger = CronTrigger.from_crontab(cronstring) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/apscheduler/triggers/cron/__init__.py", line 100, in from_crontab raise ValueError('Wrong number of fields; got {}, expected 5'.format(len(values))) ValueError: Wrong number of fields; got 3, expected 5
The schedule string is parsed by this function: https://github.com/agronholm/apscheduler/blob/028506a816c74ee05951717c0e45d2e6ad32773e/apscheduler/triggers/cron/__init__.py#L85-L103
There's unfortunately not a ton of documentation there, but basically it needs a cron-like string. If you want it to go off at 8am every day,
0 8 * * 0,1,2,3,4,5,6
or0 8 * * *
should work (those should be equivalent - 0th minute, 8th hour, every day, every month, every day of the week).One other caveat with scheduling - I never added logic to handle timezones. It's been a while since I've scheduled anything - it might default to UTC, so just be aware of that, and adjust the hour as necessary.
Let me know if that resolves your issue..
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/ChristopherRogers1991/mycroft_routine_skill/issues/10#issuecomment-686129864
-- Sent from /e/ Mail.
Awesome, thanks a ton for the help! I'll tweak things and try them out, then let you know how it went.
I set up a morning routine with Mycroft telling us good morning, telling me the weather, the news, then saying have a good day sweetie. Everything seems to be set up properly, but when I run the routine it does each step over a dozen times, eventually crashing on the news section as it brings up the stream all those times and crashes. Here is my routine json:
{ "morning": { "tasks": [ "say good morning everybody", "tell me the weather", "tell me the news", "say have a good day everyone" ], "schedule": "hour='8', minute='0', second='0'", "enabled": true } }
I changed it slightly according to APScheduler's guidelines. Originally when setting the routing for every day at 0800, the schedule said: 5 8 0,1,2,3,4,5,6. So the day of the week was right, but did it switch the time of day with year/month? Either way, I never even got to the schedule part. I've uploaded the skills.log, and I've pulled others if they might be relevant. skills.log