Mercurial > code > home > repos > homeauto
changeset 776:8fa420250799
add headboard
author | drewp@bigasterisk.com |
---|---|
date | Sun, 28 Jun 2020 14:30:52 -0700 |
parents | 2a3e791baff7 |
children | df7035db28f1 |
files | service/rdf_to_mqtt/index.html service/rdf_to_mqtt/rdf_to_mqtt.py service/rdf_to_mqtt/serv.n3 |
diffstat | 3 files changed, 27 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/service/rdf_to_mqtt/index.html Sun Jun 28 14:29:23 2020 -0700 +++ b/service/rdf_to_mqtt/index.html Sun Jun 28 14:30:52 2020 -0700 @@ -37,6 +37,12 @@ <div><button data-post="output?s=:theater&p=:volumeChange" data-body="3">Theater volume up</button></div> <div><button data-post="output?s=:theater&p=:volumeChange" data-body="-3">Theater volume down</button></div> + <div><button data-post="output?s=:bedHeadboard&p=:color" data-body="#ffffff">headboard white</button></div> + <div><button data-post="output?s=:bedHeadboard&p=:color" data-body="#000000">headboard black</button></div> + <div><button data-post="output?s=:bedHeadboard&p=:color" data-body="#ff0000">headboard red</button></div> + <div><button data-post="output?s=:bedHeadboard&p=:color" data-body="#00ff00">headboard green</button></div> + <div><button data-post="output?s=:bedHeadboard&p=:color" data-body="#0000ff">headboard blue</button></div> + <script> Array.from(document.querySelectorAll("button")).forEach((el) => { el.addEventListener("click", (ev) => {
--- 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)
--- a/service/rdf_to_mqtt/serv.n3 Sun Jun 28 14:29:23 2020 -0700 +++ b/service/rdf_to_mqtt/serv.n3 Sun Jun 28 14:30:52 2020 -0700 @@ -3,22 +3,25 @@ @prefix serv: <http://bigasterisk.com/services/> . +serv:rdf_to_mqtt_image a :DockerImage; + :dockerFile "Dockerfile"; + :internalPort 10008 + . + + + serv:rdf_to_mqtt a :Service; + :image serv:rdf_to_mqtt_image; :path "/rdf_to_mqtt/"; :openid auth:admin; :serverHost "bang"; - :internalPort 10008; :port 10008; :prodDockerFlags ( - "--net=host" ); - :localDockerFlags ( + :localRunDockerFlags ( "-v" "`pwd`:/opt" ); :prodCmdline ("python3" "rdf_to_mqtt.py"); - :localRunCmdline ( - "python3" "rdf_to_mqtt.py" "-v" - ); - :dockerFile "Dockerfile" + :localRunCmdline ( "python3" "rdf_to_mqtt.py" "-v" ); .