Hours of Service with Syrus
This tutorial will show you how to use a Bluetooth Speakerphone to speak to a driver when he/she drives for too long without stopping/resting. It's an actionable hours of service implementation with real-time driver coaching.
Result
You will learn
- How to connect a bluetooth speakerphone
- Use Syruslang custom counters
- Send text to speech commands over the bluetooth speakerphone
You will need
- Bluetooth speakerphone - example
- Syrus 4 device
This guide assumes that you have a Syrus 4 device either connected to a PC or a phone using the Syrus Terminal Application.
Connect your Bluetooth Speakerphone
-
Switch the power on in your Bluetooth Speakerphone.
-
Using the Syrus Terminal Application navigate to the HOME and in the menu option select Bluetooth
- Scan for devices and pair to the Bluetooth Speakerphone
Test audio
You should be able to press the โถ๏ธ button and hear audio.
Breakdown of the Script
The script consists of the following states:
States | Description |
---|---|
Ready to go | Driver turns vehicle ON and is ready to begin driving |
Driving | Driver is driving and below the maximum number of hours before a rest is required |
Overworking | Driver has passed the maximum continuous work hours allowed before resting |
Resting | Driver has parked the car and is considered at rest |
A detailed diagram showing the states (in white) and the actions performed (in orange).
Customize the Syruslang Configuration Script
Copy and paste the script into a text editor and edit the parameters with the speech or time values.
Customizing the script
Editing the timers
You can edit the timers of the script by changing the values of the
duration
field in the define timer lines.Example:
Timer of 2 hours
define timer driving_timer duration=120min
Timer of 6 hours
define timer driving_timer duration=360min
Change language of text to speech
You can change the language of the text to speech by changing the lines that have
speak lang=en 'text to speak'
to Spanish
speak lang=es 'texto para hablar'
Available languages are:
en
= Englishde
= Germanes
= Spanishfr
= Frenchit
= ItalianExample:
define action overworking_started trigger=sg_ign_on,@timers.driving_timer,and send event two_hours_driving start counters overwork speak lang=es 'Ha estado conduciendo por 2 horas o mรกs. por favor tome un descanso'
# Create a group definition to start the script
define group hos
# Create a counter for measuring time spent overworking
# This timer is sent on every event, if the driver has not overworked it will always be 0
define counters overwork signal=sg_ign_on start=false
# Fieldset that includes the overwork counter in a taip CV field, the value is in seconds
define fieldset hos_fields fields=$io,$gnss,CV00:$counters.overwork.total_time
# Signal for ignition detection
define signal sg_ign_on min_duration=2sec $io.ign
define signal sg_ign_off min_duration=2sec $io.ign == false
# Create and initialize a variable for when the driver is rested
define variable rested
set variable rested true
# Signal for the rested variable
define signal sg_rested $variables.rested == true
# Timers (driving and break), driving duration 6hr, rest 30min
define timer driving_timer duration=360min
define timer break_timer duration=30min
# Create events for notifying when the driving conditions are met
# These events are fired by the actions later defined
define event ev_driving_limit group=hos
ack=seq label=drvlimit
fieldset=hos_fields
define event ev_overworked_report group=hos
ack=seq label=overwork
fieldset=hos_fields
define event ev_on_break group=hos
ack=seq label=break
fieldset=hos_fields
define event ev_ign_on group=hos
ack=seq label=ignon
fieldset=hos_fields
define event ev_ign_off group=hos
ack=seq label=ignoff
fieldset=hos_fields
# Actions
# (Driver state: Driving) timer starts with ignition ON
define action driving_started trigger=sg_ign_on
start timer driving_timer
send event ev_ign_on
speak lang=en 'Starting work.'
# (Driver state: Overworking) driving timer expired
define action overworking_started trigger=sg_ign_on,@timers.driving_timer,and
start counters overwork
send event ev_driving_limit
speak lang=en 'You have been driving continuously for 6 hours. Please pull over and rest.'
# (Driver state: Resting) rest, reset timers and send the overworked report
define action resting_started trigger=sg_ign_off
stop timer driving_timer
reset counters overwork
start timer break_timer
set variable rested false
send event ev_ign_off
send event ev_overworked_report
speak lang=en 'At rest'
# (Driver state: Ready to go)
define action ready_to_go trigger=sg_ign_off,@timers.break_timer,and
stop timer break_timer
set variable rested true
send event ev_on_break
speak lang=en 'Rest finished. You may resume driving.'
# (Driver state: Trying to overwork - Not resting enough)
define action no_rest_warning trigger=sg_ign_on,sg_rested,not,and
stop timer break_timer
speak lang=en 'Warning, you have not rested enough'
# Destination
set destinations group=hos pegasus
Grab the entire text and save it into a text file with the name: configuration.syrus.conf
Create another file with the name destinations.syrus.conf
and put these two lines in it, be sure to replace it with your site info.
# Destination file with Pegasus gateway destination
define destination pegasus taip tcp://cloud.pegasusgateway.com:5000
Upload to Syrus Cloud
Use Syrus Cloud to load both configurations on a new SyrusJS application.
Once it's synchronized you can go take the Syrus for a drive with the speakerphone.
To customize this further you may consider adding driver identification with an iButton and having different rules based on who's driving.
Updated over 1 year ago