Allow initial animation and color to be set on the cmd line

This commit is contained in:
Stefan Bethke 2024-12-17 09:34:41 +01:00
parent 32bc2660d4
commit 52c1cf5c11
2 changed files with 5 additions and 3 deletions

2
dmx.py
View file

@ -165,5 +165,5 @@ class DMX:
@color.setter
def color(self, color):
if self._color != color:
self._color = color
self._color = [int(c) for c in color]
self.animation = self.animation

View file

@ -51,6 +51,8 @@ def main(args):
parser.add_argument('-l', '--listen', type=int, required=False, default=8080, help="TCP port to listen on for web")
parser.add_argument('-r', '--room', type=str, required=True, help="light setup for room: shop or big")
parser.add_argument('-u', '--universe', type=int, required=False, default=1, help="Universe to send to")
parser.add_argument('-A', '--animation', type=str, required=False, default="off", help="Initial animation")
parser.add_argument('-C', '--color', type=str, required=False, default="255,255,0", help="Initial color")
args = parser.parse_args(args)
print(f"Starting DMX via Art-Net to {args.artnet}", file=sys.stderr)
@ -86,8 +88,8 @@ def main(args):
sys.exit(64)
room = args.room
dmx.animation = Off()
dmx.color = (0, 0, 0)
dmx.animation = "off"
dmx.color = args.color.split(',')
dmx.animation = args.animation
run(host='0.0.0.0', port=args.listen, reloader=False, debug=True)