I'm trying to do the same thing (Octoprint as root) because I'm using an string of RGB leds (WS2811) and trying to use the PWM on gpio 18. The test python script runs fine as 'sudo'. But I get a -5 error on mmap() call in the script.
Is there another pin to use for RGB_Status plug in?
Or a different pluging?
And then again, OctoPrint itself (as delivered via the OctoPi image) uses some files in the /etc/sudoers.d/ folder to allow things to happen via the pi user without prompting for a password when sudo is used.
pi@octopi:~ $ ls -l /etc/sudoers.d
-r--r----- 1 root root 36 Nov 26 2018 010_at-export
-r--r----- 1 root root 28 May 7 2018 010_pi-nopasswd
-rw-r--r-- 1 root root 35 May 7 2018 octoprint-service
-rw-r--r-- 1 root root 32 May 7 2018 octoprint-shutdown
-r--r----- 1 root root 958 Jun 5 2017 README
-rw-r--r-- 1 root root 36 Apr 2 11:52 reboot
Thanks for the replies. I tried adding 'pi' to the gpio group.
It said it was already a memory of the gpio group.
I tried the rpi_ws281x repo on github, and ran it w/o sudo on pin 10 (the SPI pin)
but no response from the LED. I connected the LED string to pin 24 on the 3B+ header.
Edited the strandtest.py to make sure I was using pin 10. still No luck.
Next I changed the python script to use GPIO 18 (for the PWM). Moved to pin 12 on the 3B+ header,
and ran the python script as sudo. It worked!
So either I need to crack the code on using the SPI pin, or get octoprint running as root. I realize this is a security issue, but my printer is behind a firewall, and has smoke detectors on it...