From 52c1cf5c11ebe1443d9b0e52109833ab406a8ccf Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Tue, 17 Dec 2024 09:34:41 +0100 Subject: [PATCH] Allow initial animation and color to be set on the cmd line --- dmx.py | 2 +- foobaz.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dmx.py b/dmx.py index d313f11..453d116 100644 --- a/dmx.py +++ b/dmx.py @@ -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 diff --git a/foobaz.py b/foobaz.py index 0db4db2..7e0812b 100644 --- a/foobaz.py +++ b/foobaz.py @@ -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)