# HG changeset patch # User drewp@bigasterisk.com # Date 1706562083 28800 # Node ID 178e020289c196129bbba97fc7827df6f16af03f # Parent b8201490c73158ca9ee657efb9b68b5b3507e519 'full' button; other clean up diff -r b8201490c731 -r 178e020289c1 light.py --- a/light.py Mon Jan 29 12:27:08 2024 -0800 +++ b/light.py Mon Jan 29 13:01:23 2024 -0800 @@ -102,6 +102,8 @@ _d: dict[str, Light] = {} def __init__(self, mqtt: MqttIo): + # todo: combine mqtt, aiohttp session, and pigpiod client into some + # Transports object self.mqtt = mqtt self.add(makeZbBar(mqtt, 'do-bar', '0xa4c13844948d2da4')) diff -r b8201490c731 -r 178e020289c1 src/main.ts --- a/src/main.ts Mon Jan 29 12:27:08 2024 -0800 +++ b/src/main.ts Mon Jan 29 13:01:23 2024 -0800 @@ -86,7 +86,7 @@

Updated ${this.reportTime.toLocaleString("sv")}

- metrics | + metrics | code | graph

@@ -112,8 +112,9 @@ ${this.renderLinked(d.address)} ${d.requestingColor} - - + + + ${JSON.stringify(d.requestingDeviceColor)} ${d.emittingColor} @@ -131,19 +132,9 @@ return addr; } - async onRequestingColor(lightName: string, ev: InputEvent) { + async onRequestingColor(lightName: string, preset: string | null, ev: InputEvent) { const currentRequest = this.lightByName.get(lightName)!.requestingColor; - const value = (ev.target as HTMLInputElement).value; - this.onCol(value, currentRequest, lightName); - } - - async onZero(lightName: string, ev: InputEvent) { - const currentRequest = this.lightByName.get(lightName)!.requestingColor; - const value = "#000000"; - this.onCol(value, currentRequest, lightName); - } - - private onCol(value: string, currentRequest: string, lightName: string) { + const value = preset || (ev.target as HTMLInputElement).value; console.log("LbPage ~ onRequestingColor ~ value === currentRequest:", value, currentRequest); if (value === currentRequest) { return;