This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; |