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
| import json | |
| import logging | |
| import getpass | |
| import argparse | |
| import paho.mqtt.client as mqtt # paho-mqtt | |
| payloads = { | |
| "homeassistant/device_automation/B0C1/%MQTT_PREFIX%/config": { | |
| "automation_type":"trigger", | |
| "topic": "%MQTT_PREFIX%/buttons/0/click/1", |
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 mapData = msg.payload; | |
| const _pixelSize = mapData.pixelSize; | |
| let _robotXY = null; | |
| for (let i = 0; i < mapData.entities.length; i++) { | |
| if (mapData.entities[i].type == "robot_position") { | |
| _robotXY = { | |
| x: Math.floor(mapData.entities[i].points[0] / _pixelSize), | |
| y: Math.floor(mapData.entities[i].points[1] / _pixelSize) | |
| }; | |
| break; |