Mercurial > code > home > repos > homeauto
diff service/rdf_to_mqtt/rdf_to_mqtt.py @ 776:8fa420250799
add headboard
author | drewp@bigasterisk.com |
---|---|
date | Sun, 28 Jun 2020 14:30:52 -0700 |
parents | 82bea37aeb92 |
children | df7035db28f1 |
line wrap: on
line diff
--- a/service/rdf_to_mqtt/rdf_to_mqtt.py Sun Jun 28 14:29:23 2020 -0700 +++ b/service/rdf_to_mqtt/rdf_to_mqtt.py Sun Jun 28 14:30:52 2020 -0700 @@ -56,6 +56,9 @@ 'root': 'theater_blaster/ir_out', 'values': 'theaterOutputs', }, + ROOM['bedHeadboard']: { + 'root': 'bed/light/headboard/command', + }, #-t theater_blaster/ir_out -m 'input_game' #-t theater_blaster/ir_out -m 'input_bd' #-t theater_blaster/ir_out -m 'input_cbl' @@ -100,6 +103,14 @@ self._publish(topic=f'theater_blaster/ir_out/volume_{which}', message=json.dumps({'timed': abs(delta)})) ignored = False + if stmt[0:2] == (dev, ROOM['color']): + h = stmt[2].toPython() + r,g,b = int(h[1:3], 16), int(h[3:5], 16), int(h[5:7], 16) + self._publish(topic=attrs['root'], + message=json.dumps({'state': 'ON' if r or g or b else 'OFF', + 'color': {'r': r, 'g': g, 'b': b}, + 'white_value': max(r, g, b)})) + ignored = false if ignored: log.warn("ignoring %s", stmt)