This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"e3bbd992.6544d8","type":"inject","z":"ffbd7f06.4a014","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":944,"wires":[["5e7064be.6a665c"]]},{"id":"e32fd63f.6e1c38","type":"debug","z":"ffbd7f06.4a014","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":486,"y":944,"wires":[]},{"id":"5e7064be.6a665c","type":"function","z":"ffbd7f06.4a014","name":"","func":"const snips = global.get(\"snips\");\nmsg.payload = snips.add(1,2);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":944,"wires":[["e32fd63f.6e1c38"]]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"b8f1078b.24ad98","type":"ha-entity","z":"530c54b8.7cee3c","name":"Xfinity Usage","server":"55a65aed.d6a484","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Xfinity Usage"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:percent"},{"property":"unit_of_measurement","value":""}],"state":"currentUsage & \"/\" & allowableUsage & \" GB (\" & $round(currentUsage / allowableUsage * 100, 0) & \"%)\"","stateType":"jsonata","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":582,"y":128,"wires":[[]]},{"id":"f35fd1cd.e4526","type":"http in","z":"530c54b8.7cee3c","name":"","url":"/xfinity","method":"post","upload":false,"swaggerDoc":"","x":182,"y":176,"wires":[["325034f4.cb3e7c","bb07c2f8.50e11"]]},{"id":"325034f4.cb3e7c","type":"http response","z":"530c54b8.7cee3c","name":"","statusCode":"","headers":{},"x":354,"y":128,"wires":[]},{"id":"da9ef037.484c1","type":"comment","z":"530c54 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"884762f5.cd0d","type":"ha-api","z":"33f42d45.e29ad2","name":"areas","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/area_registry/list\"}","dataType":"json","location":"areas","locationType":"msg","responseType":"json","x":370,"y":256,"wires":[["611635f4.9fa17c"]]},{"id":"13514152.b154ef","type":"inject","z":"33f42d45.e29ad2","name":"Manual Update","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":176,"y":256,"wires":[["884762f5.cd0d"]]},{"id":"611635f4.9fa17c","type":"ha-api","z":"33f42d45.e29ad2","name":"devices","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/device_registry/list\"}","dataType":"json","location":"devices","locationType":"msg","responseType":"json","x":510,"y":256,"wires":[["4448646c.da0b7c"]]},{"id":"4448646c.da0b7c","type":"ha-api","z":"33f42d45.e29ad2","name":"entities","debugenabled":false,"protocol":"websocket","method":"get","pa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@callback | |
def handle_discovery_update(self, msg): | |
"""Update entity config""" | |
if CONF_REMOVE in msg: | |
# Remove entity | |
if msg[CONF_REMOVE] == CHANGE_ENTITY_TYPE: | |
# recreate entity if component type changed | |
@callback | |
def recreate_entity(): | |
"""Create entity with new type""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocket = require("ws"); | |
const hajw = require("home-assistant-js-websocket"); | |
global.WebSocket = WebSocket; | |
const server = new WebSocket.Server({ | |
port: 8081 | |
}); | |
server.on("connection", function connection(ws) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const old_date = Date(msg.data.new_state.last_updated); | |
const new_date = Date(msg.data.old_state.last_updated); | |
const new_state = msg.data.new_state.state; | |
const old_state = msg.data.old_state.state; | |
const seconds = (new_date - old_date) / 1000; | |
if (new_state != old_state) { | |
if (seconds > 300) { | |
msg.payload = { data: { 'entity_id': 'device_tracker.google_maps_id', 'state': 'home' } }; | |
return msg; |