I followed the guidelines as described in this link:
Running the FlowFuse Device Agent as a service on a Raspberry Pi • FlowFuse
Description=flowfuse Device Agent
Wants=network.target
Documentation=Documentation • FlowFuse
[Service]
Type=simple
Run as normal pi user - change to the user name you wish to run flowfuse Device as
User=root
Group=root
WorkingDirectory=/opt/flowfuse-device
Environment="NODE_OPTIONS=--max_old_space_size=512"
ExecStart=/usr/bin/env flowfuse-device-agent
Use SIGINT to stop
KillSignal=SIGINT
Auto restart on crash
Restart=on-failure
RestartSec=20
Tag things in the log
SyslogIdentifier=flowfuseDevice
#StandardOutput=syslog
[Install]
WantedBy=multi-user.target