Services

The basic structure of the Dinkum code base.

Dinkum breaks Core into distinct systemd services:

  • audio

    • Audio playback using SDL2 mixer

    • Music streaming using VLC

    • Text to speech using Mimic 3

  • enclosure

    • Wi-Fi and pairing

  • gui

    • QML-based interface

  • intent

    • Intent registration and matching

    • Session management

  • hal

    • LED animations

    • Buttons and switches

    • Volume

  • messagebus

    • Websocket-based message broadcast

  • skills

    • Each skill is loaded and run individually by the skills service.

    • Skills have a skill_id, which is always the name of their code directory (e.g., alarm.mark2 for skills/alarm.mark2).

  • voice

    • Microphone input, silence detection, speech to text

systemd units

Each Dinkum service is run as a systemd unit. The sdnotify Python package is used to inform systemd when the service has successfully started, and maintain a watchdog.

The scripts/generate-systemd-units.py script will write .service and .target files to /etc/systemd/system (sudo required). For example:

cd mycroft-dinkum/
sudo scripts/generate-systemd-units.py \
        --user pi \
        --service 0 services/messagebus \
        --service 1 services/hal \
        --service 1 services/audio \
        --service 1 services/gui \
        --service 1 services/intent \
        --service 1 services/voice \
        --service 2 services/skills \
        --service 3 services/enclosure \
        --skill skills/alarm.mark2 \
        --skill skills/date.mark2 \
        --skill skills/fallback-query.mark2 \
        --skill skills/fallback-unknown.mark2 \
        --skill skills/homescreen.mark2 \
        --skill skills/ip.mark2 \
        --skill skills/news.mark2 \
        --skill skills/query-duck-duck-go.mark2 \
        --skill skills/query-wiki.mark2 \
        --skill skills/query-wolfram-alpha.mark2 \
        --skill skills/settings.mark2 \
        --skill skills/stop.mark2 \
        --skill skills/time.mark2 \
        --skill skills/timer.mark2 \
        --skill skills/volume.mark2 \
        --skill skills/weather.mark2

will start most of the default services and skills. The --service arguments have a priority number that controls the order the services will start. Higher numbers start later, and depend on the lower-numbered services. Skills will all start whenever services/skills is listed.

After generating systemd units, make sure to sudo systemctl daemon-reload and then you can sudo systemctl start dinkum.target

Logs

All logs go into journalctl, so they can be viewed in realtime with sudo journalctl -f -xe

You can also view individual service or skill logs:

  • sudo journalctl -f -u dinkum-audio.service

  • sudo journalctl -f -u dinkum-skill-homescreen.mark2.service

Leave off the -f to see the complete history of a service's log.

See dinkum* in /etc/systemd/system for available units. dinkum.target is the root unit.

Last updated