Skip to content

Instantly share code, notes, and snippets.

@Peetz0r
Last active July 11, 2020 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Peetz0r/547b7464fbcf02052b6840bcbc6b8b94 to your computer and use it in GitHub Desktop.
Save Peetz0r/547b7464fbcf02052b6840bcbc6b8b94 to your computer and use it in GitHub Desktop.
#!/bin/python3
import openrgb, glob
C = openrgb.utils.RGBColor
o = openrgb.OpenRGBClient()
d = o.devices[0]
z = d.zones[0]
d.set_mode(0)
while True:
t = max([int(open(i).read()) for i in glob.glob('/sys/class/hwmon/hwmon?/temp?_input')])/1000
i = int(max(0,min(255, (t-30) / 60 * 256)))
c = C(i, 255-i, 0)
# print('t = %5.2f°C; i = %d; c = %s' % (t, i, c))
z.set_color(c)
[Unit]
Description=Hot (temps => RGB)
Wants=openrgb.service
After=openrgb.service
[Service]
ExecStart=/home/peter/bin/hot.py
Restart=on-failure
User=peter
[Install]
WantedBy=multi-user.target
[Unit]
Description=OpenRGB server
[Service]
ExecStart=/home/peter/OpenRGB/OpenRGB --server
ExecStartPost=sh -c 'until lsof -i :6742; do sleep .1; done;'
Restart=on-failure
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment