Skip to content

Instantly share code, notes, and snippets.

@rmeekers
Last active May 16, 2022
Embed
What would you like to do?
Node Red flow to monitor Eeve / Toadi to Home Assistant via MQTT (including auto discovery) - https://community.home-assistant.io/t/eeve-toadi-willow/405097
[
{
"id": "76106b40e1ce3c2f",
"type": "tab",
"label": "Toadi to MQTT",
"disabled": false,
"info": "",
"env": []
},
{
"id": "96d3578edea17616",
"type": "mqtt out",
"z": "76106b40e1ce3c2f",
"name": "mqtt without retain",
"topic": "",
"qos": "",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "2e41d93bbc757522",
"x": 2010,
"y": 500,
"wires": [],
"info": "test"
},
{
"id": "387feb57279c6081",
"type": "http request",
"z": "76106b40e1ce3c2f",
"name": "get JSON",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": true,
"x": 1320,
"y": 720,
"wires": [
[
"95f6125c76ec6397"
]
]
},
{
"id": "b3cbb9d498e874a0",
"type": "inject",
"z": "76106b40e1ce3c2f",
"name": "update sensors",
"props": [
{
"p": "flowType",
"v": "sensor",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 120,
"y": 600,
"wires": [
[
"04a16c61b97c0c48"
]
]
},
{
"id": "f759a0440ba72711",
"type": "debug",
"z": "76106b40e1ce3c2f",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 290,
"y": 1420,
"wires": []
},
{
"id": "a6100dd501e39a5a",
"type": "mqtt out",
"z": "76106b40e1ce3c2f",
"name": "",
"topic": "Toadi/connectionError",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "2e41d93bbc757522",
"x": 340,
"y": 1360,
"wires": []
},
{
"id": "ec24fc8a6daacf23",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/batteryStatus",
"func": "/*\nhttp://x.x.x.x:8080/system/batteryStatus\n{\n\t\"availableMowingTime\" : 315,\n\t\"percentagePerMowingHour\" : 15.238095283508301,\n\t\"temperature\" : 12.338845638344537\n}\n*/\nreturn [[\n {\n payload: {\n unique_id: 'toadi_system_battery_status_temperature',\n name: 'Toadi System Battery Status Temperature',\n device: msg.toadi_device,\n device_class: 'temperature',\n unit_of_measurement: '°C',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.temperature | round(2) }}'\n },\n topic: 'homeassistant/sensor/toadi_system_battery_status_temperature/config'\n }\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2400,
"y": 480,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "761fd018457e7f1b",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/mowingInfo",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 760,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "5c567fbdecda6ed6",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/bootcount",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 890,
"y": 460,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "183b43ce53783815",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/batteryStatus",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 400,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "8340aa773f294d7b",
"type": "mqtt out",
"z": "76106b40e1ce3c2f",
"name": "mqtt with retain",
"topic": "",
"qos": "",
"retain": "true",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "2e41d93bbc757522",
"x": 3080,
"y": 580,
"wires": [],
"info": "test"
},
{
"id": "61c50381c54865aa",
"type": "switch",
"z": "76106b40e1ce3c2f",
"name": "endpoint",
"property": "endpoint",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "/image/front/img.jpg",
"vt": "str"
},
{
"t": "eq",
"v": "/activities/info",
"vt": "str"
},
{
"t": "eq",
"v": "/statuslog",
"vt": "str"
},
{
"t": "eq",
"v": "/statuslog/sensors/gps",
"vt": "str"
},
{
"t": "eq",
"v": "/system/batteryStatus",
"vt": "str"
},
{
"t": "eq",
"v": "/system/dockingInfo",
"vt": "str"
},
{
"t": "eq",
"v": "/system/emergencyStop",
"vt": "str"
},
{
"t": "eq",
"v": "/system/heater",
"vt": "str"
},
{
"t": "eq",
"v": "/system/mowerInfo",
"vt": "str"
},
{
"t": "eq",
"v": "/system/mowingInfo",
"vt": "str"
},
{
"t": "eq",
"v": "/system/networkInfo",
"vt": "str"
},
{
"t": "eq",
"v": "/system/sensors/baseboard",
"vt": "str"
},
{
"t": "eq",
"v": "/system/sensors/module",
"vt": "str"
},
{
"t": "eq",
"v": "/system/version",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 14,
"x": 1980,
"y": 700,
"wires": [
[
"6e31f46ba897da46"
],
[
"9559d0d72d116929"
],
[
"8d3d735006a53297"
],
[],
[
"ec24fc8a6daacf23"
],
[
"75a156e52979dd3a"
],
[
"2cbdab2133af225f"
],
[
"0738698a8191be2b"
],
[
"cebc9815313d631d"
],
[
"7c1771d0d7915608"
],
[
"68a42e7c77ec30f4"
],
[],
[],
[
"2984acf962d93d1e"
]
]
},
{
"id": "7c1771d0d7915608",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/mowingInfo",
"func": "/*\nhttp://x.x.x.x:8080/system/mowingInfo\n{\n\t\"currentZoneId\" : 1,\n\t\"lastRainTime\" : \"2022-03-20 09:50:02\",\n\t\"mowingTime\" : \n\t{\n\t\t\"today\" : 0,\n\t\t\"total\" : 4271\n\t},\n\t\"nextZoneId\" : -1,\n\t\"numberOfZones\" : 1,\n\t\"todayEndTime\" : \"15:56:27\",\n\t\"totalArea\" : 1004.849096,\n\t\"totalElapsedMowingTime\" : 1742,\n\t\"totalRequiredMowingTime\" : 0,\n\t\"zonesInfo\" : \n\t[\n\t\t{\n\t\t\t\"area\" : 1004.849096,\n\t\t\t\"elapsedMowingTime\" : 1742,\n\t\t\t\"elapsedMowingTimeToday\" : 0,\n\t\t\t\"id\" : 1,\n\t\t\t\"requiredMowingTime\" : 0,\n\t\t\t\"resumeMowingTime\" : \"2022-03-22 09:41:00\"\n\t\t}\n\t]\n}\n*/\nvar zonesInfo = msg.payload.zonesInfo;\nvar numberOfZones = zonesInfo.length;\nvar result = [\n{\n payload: {\n unique_id: 'toadi_system_mowing_info_current_zone_id',\n name: 'Toadi System Mowing Info Current Zone Id',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:texture-box',\n value_template: '{{ value_json.currentZoneId }}'\n },\n topic: 'homeassistant/sensor/toadi_system_mowing_info_current_zone_id/config'\n},{\n payload: {\n unique_id: 'toadi_system_mowing_info_mowing_time_today',\n name: 'Toadi System Mowing Info Mowing Time Today',\n device: msg.toadi_device,\n unit_of_measurement: 'min',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:timer-outline',\n value_template: '{{ value_json.mowingTime.today }}'\n },\n topic: 'homeassistant/sensor/toadi_system_mowing_info_mowing_time_today/config'\n},{\n payload: {\n unique_id: 'toadi_system_mowing_info_mowing_time_total',\n name: 'Toadi System Mowing Info Mowing Time Total',\n device: msg.toadi_device,\n unit_of_measurement: 'min',\n state_class:'total',\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:timer-outline',\n value_template: '{{ value_json.mowingTime.total }}'\n },\n topic: 'homeassistant/sensor/toadi_system_mowing_info_mowing_time_total/config'\n}\n];\n\n\nfor (var i = 0; i < numberOfZones; i++) {\n result.push(\n {\n payload: {\n unique_id: 'toadi_system_mowing_info_zone_'+zonesInfo[i].id,\n name: 'Toadi System Mowing Info Zone '+zonesInfo[i].id,\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:texture-box',\n value_template: '{% if value_json.currentZoneId == value_json.zonesInfo['+i+'].id %}Mowing{% else %}Idle{% endif %}',\n payload_on: 'Mowing',\n payload_off: 'Idle',\n json_attributes_topic: 'Toadi'+msg.endpoint,\n json_attributes_template: '{\"area\": \"{{ value_json.zonesInfo['+i+'].area | round(0) }}\", \"elapsedMowingTime\": \"{{ (value_json.zonesInfo['+i+'].elapsedMowingTime / 60) | round(0) }}\", \"elapsedMowingTimeToday\": \"{{ (value_json.zonesInfo['+i+'].elapsedMowingTimeToday / 60) | round(0) }}\", \"requiredMowingTime\": \"{{ (value_json.zonesInfo['+i+'].requiredMowingTime / 60) | round(0) }}\", \"percentageComplete\": \"{% if 0 in [ value_json.zonesInfo['+i+'].requiredMowingTime, value_json.zonesInfo['+i+'].elapsedMowingTime ] %}0{% else %}{{ ((value_json.zonesInfo['+i+'].requiredMowingTime / value_json.zonesInfo['+i+'].elapsedMowingTime) * 10) | round(0) }}{% endif %}\"}'\n },\n topic: 'homeassistant/binary_sensor/toadi_system_mowing_info_zone_'+zonesInfo[i].id+'/config'\n }\n );\n}\n\nreturn [result];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2400,
"y": 760,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "75a156e52979dd3a",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/dockingInfo",
"func": "/*\nhttp://x.x.x.x:8080/system/dockingInfo\n\n{\n\t\"chargeStatus\" : \"Vin Uvcl active\",\n\t\"chargerState\" : \"cc-cv charge\",\n\t\"chargingCurrent\" : 2.4362164878845216,\n\t\"chargingPower\" : 32.176526481073097,\n\t\"counters\" : \n\t{\n\t\t\"AutoCharging\" : 111,\n\t\t\"ConnectToCharger\" : 10,\n\t\t\"FindPositionInMap\" : 8,\n\t\t\"GotoChargingStationProximity\" : 221,\n\t\t\"GotoRetryPosition\" : 575,\n\t\t\"ManualCharging\" : 130,\n\t\t\"PositionInFrontOfChargingStation\" : 390,\n\t\t\"StartDocking\" : 2\n\t},\n\t\"dockingPosition\" : \"Good\",\n\t\"dockingState\" : \"AutoCharging\"\n}\n*/\nreturn [[\n {\n payload: {\n unique_id: 'toadi_system_docking_info_docking_state',\n name: 'Toadi System Docking Info Docking State',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.dockingState }}'\n },\n topic: 'homeassistant/sensor/toadi_system_docking_info_docking_state/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_docking_info_docking_position',\n name: 'Toadi System Docking Info Docking Position',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.dockingPosition }}'\n },\n topic: 'homeassistant/sensor/toadi_system_docking_info_docking_position/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_docking_info_charge_status',\n name: 'Toadi System Docking Info Charge Status',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.chargeStatus }}'\n },\n topic: 'homeassistant/sensor/toadi_system_docking_info_charge_status/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_docking_info_charger_state',\n name: 'Toadi System Docking Info Charger State',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.chargerState }}'\n },\n topic: 'homeassistant/sensor/toadi_system_docking_info_charger_state/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_docking_info_charging_current',\n name: 'Toadi System Docking Info Charging Current',\n device: msg.toadi_device,\n device_class: 'current',\n unit_of_measurement: 'A',\n state_class: 'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.chargingCurrent }}'\n },\n topic: 'homeassistant/sensor/toadi_system_docking_info_charging_current/config'\n }\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2400,
"y": 540,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "619cb37dde2fb1c4",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/dockingInfo",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 520,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "cebc9815313d631d",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/mowerInfo",
"func": "/*\nhttp://x.x.x.x:8080/system/mowerInfo\n{\n\t\"mowerHeight\" : 0.042000003159046173,\n\t\"rpm\" : 0\n}\n*/\n\nreturn [[\n{\n payload: {\n unique_id: 'toadi_system_mower_info_mower_height',\n name: 'Toadi System Mower Info Mower Height',\n device: msg.toadi_device,\n unit_of_measurement: 'cm',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:align-vertical-distribute',\n value_template: '{{ (value_json.mowerHeight | float * 100) | round(2) }}'\n },\n topic: 'homeassistant/sensor/toadi_system_mower_info_mower_height/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2390,
"y": 700,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "c75109632993a0c4",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/mowerInfo",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 890,
"y": 700,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "2984acf962d93d1e",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/version",
"func": "/*\nhttp://x.x.x.x:8080/system/version\n{\n\t\"applicationVersion\" : \"3.3.8-202203041428+1595455\",\n\t\"osVersion\" : \"5b4df5062a9f010a621ffb72a2f0688fc921c450\"\n}\n*/\n\nreturn [[\n{\n payload: {\n unique_id: 'toadi_system_version_application',\n name: 'Toadi System Version Application',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:application',\n value_template: '{{ value_json.applicationVersion }}'\n },\n topic: 'homeassistant/sensor/toadi_system_version_application/config'\n},{\n payload: {\n unique_id: 'toadi_system_version_os',\n name: 'Toadi System Version OS',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:calendar-text',\n value_template: '{{ value_json.osVersion }}'\n },\n topic: 'homeassistant/sensor/toadi_system_version_os/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2380,
"y": 880,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "aa1bad3ea0438083",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/version",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 880,
"y": 880,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "b31760fa1183b122",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/heater",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 880,
"y": 640,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "0738698a8191be2b",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/heater",
"func": "/*\nhttp://x.x.x.x:8080/system/heater\n{\n\t\"status\" : \"off\"\n}\n*/\nreturn [[\n{\n payload: {\n unique_id: 'toadi_system_heater_status',\n name: 'Toadi System Heater Status',\n device: msg.toadi_device,\n device_class: 'heat',\n payload_on: 'on',\n payload_off: 'off',\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:radiator',\n value_template: '{{ value_json.status }}'\n },\n topic: 'homeassistant/binary_sensor/toadi_system_heater_status/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2380,
"y": 640,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "63e4f4f32668d8d8",
"type": "inject",
"z": "76106b40e1ce3c2f",
"name": "update MQTT discovery",
"props": [
{
"p": "flowType",
"v": "mqttDiscovery",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 01 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 150,
"y": 480,
"wires": [
[
"04a16c61b97c0c48"
]
]
},
{
"id": "95f6125c76ec6397",
"type": "switch",
"z": "76106b40e1ce3c2f",
"name": "flowType",
"property": "flowType",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "camera",
"vt": "str"
},
{
"t": "eq",
"v": "sensor",
"vt": "str"
},
{
"t": "eq",
"v": "mqttDiscovery",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 1760,
"y": 680,
"wires": [
[
"96d3578edea17616"
],
[
"96d3578edea17616"
],
[
"61c50381c54865aa"
]
]
},
{
"id": "68a42e7c77ec30f4",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/networkInfo",
"func": "/*\nhttp://x.x.x.x:8080/system/networkInfo\n{\n\t\"default\" : \"Wifi\",\n\t\"mobile\" : \n\t{\n\t\t\"reason\" : \"None\",\n\t\t\"state\" : \"Online\"\n\t},\n\t\"state\" : \"Online\",\n\t\"wifi\" : \n\t{\n\t\t\"localIp\" : \"x.x.x.x\",\n\t\t\"reason\" : \"None\",\n\t\t\"signal\" : 51,\n\t\t\"ssid\" : \"IoT\",\n\t\t\"state\" : \"Online\"\n\t}\n}\n*/\n\nreturn [[\n{\n payload: {\n unique_id: 'toadi_system_network_info_wifi_signal',\n name: 'Toadi System Network Info Wifi Signal',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n unit_of_measurement: '%',\n icon: 'mdi:signal',\n value_template: '{{ value_json.wifi.signal }}'\n },\n topic: 'homeassistant/sensor/toadi_system_network_info_wifi_signal/config'\n},{\n payload: {\n unique_id: 'toadi_system_network_info_wifi_ssid',\n name: 'Toadi System Network Info Wifi SSID',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:wifi',\n value_template: '{{ value_json.wifi.ssid }}'\n },\n topic: 'homeassistant/sensor/toadi_system_network_info_wifi_ssid/config'\n},{\n payload: {\n unique_id: 'toadi_system_network_info_wifi_state',\n name: 'Toadi System Network Info Wifi State',\n device: msg.toadi_device,\n device_class: 'connectivity',\n payload_on: 'Online',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.wifi.state }}'\n },\n topic: 'homeassistant/binary_sensor/toadi_system_network_info_wifi_state/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2400,
"y": 820,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "f7f5a1591560d725",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/networkInfo",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 820,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "6e31f46ba897da46",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/image/front/img.jpg",
"func": "return [[\n {\n payload: {\n unique_id: 'toadi_camera_front',\n name: 'Toadi Camera Front',\n device: msg.toadi_device,\n topic: 'Toadi'+msg.endpoint\n },\n topic: 'homeassistant/camera/toadi_camera_front/config'\n }\n]];\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2400,
"y": 300,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "28c611484608b74a",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/image/front/img.jpg",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 220,
"wires": [
[
"55076840c02b7206"
]
]
},
{
"id": "55076840c02b7206",
"type": "http request",
"z": "76106b40e1ce3c2f",
"name": "GET binary",
"method": "GET",
"ret": "bin",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": true,
"x": 1330,
"y": 660,
"wires": [
[
"95f6125c76ec6397"
]
]
},
{
"id": "f1be1b950a2889a4",
"type": "catch",
"z": "76106b40e1ce3c2f",
"name": "",
"scope": null,
"uncaught": false,
"x": 80,
"y": 1380,
"wires": [
[
"a6100dd501e39a5a",
"f759a0440ba72711"
]
]
},
{
"id": "e4fd59041da2693b",
"type": "inject",
"z": "76106b40e1ce3c2f",
"name": "update camera",
"props": [
{
"p": "flowType",
"v": "camera",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 120,
"y": 540,
"wires": [
[
"04a16c61b97c0c48"
]
]
},
{
"id": "7e5b6ed9d9f24c8b",
"type": "switch",
"z": "76106b40e1ce3c2f",
"name": "flowType",
"property": "flowType",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "camera",
"vt": "str"
},
{
"t": "eq",
"v": "switch",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 580,
"y": 540,
"wires": [
[
"28c611484608b74a"
],
[
"7d4f818461d1c5db"
],
[
"183b43ce53783815",
"5c567fbdecda6ed6",
"619cb37dde2fb1c4",
"b31760fa1183b122",
"c75109632993a0c4",
"761fd018457e7f1b",
"f7f5a1591560d725",
"aa1bad3ea0438083",
"212e3b35dc3e18a2",
"0478a7dfb29dc976",
"9865bc2d7ef29571"
]
]
},
{
"id": "212e3b35dc3e18a2",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/emergencyStop",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;\n\n\n// return [[\n// {\n// url: msg.toadi_uri + node.name,\n// topic: 'Toadi' + node.name,\n// endpoint: node.name\n// }\n// ]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 910,
"y": 580,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "2cbdab2133af225f",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/system/emergencyStop",
"func": "/*\nhttp://x.x.x.x:8080/system/emergencyStop\n{\n\t\"description\" : \"Sensors: [\\\"learning\\\"]\"\n}\n*/\nreturn [[\n{\n payload: {\n unique_id: 'toadi_system_emergency_stop_description',\n name: 'Toadi System Emergency Stop Description',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:car-brake-alert',\n value_template: '{{ value_json.description }}'\n },\n topic: 'homeassistant/sensor/toadi_system_emergency_stop_description/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2410,
"y": 580,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "0478a7dfb29dc976",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/statuslog",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 860,
"y": 340,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "8d3d735006a53297",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/statuslog",
"func": "return [[\n {\n payload: {\n unique_id: 'toadi_statuslog_activity',\n name: 'Toadi Statuslog Activity',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{% for key in value_json.statuslog.activity %}{{key}},{% endfor %}'\n },\n topic: 'homeassistant/sensor/toadi_statuslog_activity/config'\n },\n {\n payload: {\n unique_id: 'toadi_statuslog_sensor_gps',\n name: 'Toadi',\n device: msg.toadi_device,\n source_type: 'gps',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.sensors.gps.valid }}',\n payload_available: 'true',\n payload_not_available: 'false',\n icon: 'mdi:robot-mower',\n json_attributes_topic: 'Toadi'+msg.endpoint,\n json_attributes_template: '{\"latitude\": \"{{ value_json.statuslog.sensors.gps.latitude}}\", \"longitude\": \"{{ value_json.statuslog.sensors.gps.longitude}}\", \"gps_accuracy\": \"{{ value_json.statuslog.sensors.gps.accuracy}}\"}'\n },\n topic: 'homeassistant/sensor/toadi_statuslog_sensor_gps/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_sensors_baseboard_humidity',\n name: 'Toadi System Sensors Baseboard Humidity',\n device: msg.toadi_device,\n device_class: 'humidity',\n unit_of_measurement: '%',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.sensors.humidity.baseboard | round (0) }}'\n },\n topic: 'homeassistant/sensor/toadi_system_sensors_baseboard_humidity/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_sensors_baseboard_temperature',\n name: 'Toadi System Sensors Baseboard Temperature',\n device: msg.toadi_device,\n device_class: 'temperature',\n unit_of_measurement: '°C',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.sensors.temperature.baseboard | round (2) }}'\n },\n topic: 'homeassistant/sensor/toadi_system_sensors_baseboard_temperature/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_sensors_module_temperature',\n name: 'Toadi System Sensors Module Temperature',\n device: msg.toadi_device,\n device_class: 'temperature',\n unit_of_measurement: '°C',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.sensors.temperature.module | round (2) }}'\n },\n topic: 'homeassistant/sensor/toadi_system_sensors_module_temperature/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_mower_info_rpm',\n name: 'Toadi System Mower Info Rpm',\n device: msg.toadi_device,\n unit_of_measurement: 'rpm',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:fan',\n value_template: '{{ value_json.statuslog.mower.rpm }}'\n },\n topic: 'homeassistant/sensor/toadi_system_mower_info_rpm/config'\n },\n {\n payload: {\n unique_id: 'toadi_system_battery_status_charger_state',\n name: 'Toadi System Battery Status Charger State',\n device: msg.toadi_device,\n device_class: 'power',\n payload_on: '1',\n payload_off: '0',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.battery.chargerState }}'\n },\n topic: 'homeassistant/binary_sensor/toadi_system_battery_status_charger_state/config'\n },{\n payload: {\n unique_id: 'toadi_system_battery_status_percentage',\n name: 'Toadi System Battery Status Percentage',\n device: msg.toadi_device,\n device_class: 'battery',\n unit_of_measurement: '%',\n state_class:'measurement',\n state_topic: 'Toadi'+msg.endpoint,\n value_template: '{{ value_json.statuslog.battery.percentage }}'\n },\n topic: 'homeassistant/sensor/toadi_system_battery_status_percentage/config'\n },{\n payload: {\n unique_id: 'toadi_navigation_emergency_stop_hard',\n name: 'Toadi Navigation Emergency Stop',\n device: msg.toadi_device,\n icon: 'mdi:car-brake-alert',\n state_topic: 'Toadi'+msg.endpoint,\n state_on: true,\n state_off: false,\n optimistic: false,\n value_template: '{{ value_json.statuslog.emergencyStop.active }}',\n command_topic: 'Toadi/system/emergencyStop/set'\n },\n topic: 'homeassistant/switch/toadi_activities_info_scheduled_activity/config'\n }\n]];\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2360,
"y": 420,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "054e2bd88954b5b1",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/logs.html",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 860,
"y": 940,
"wires": [
[]
]
},
{
"id": "c010a44de007e3f9",
"type": "websocket in",
"z": "76106b40e1ce3c2f",
"d": true,
"name": "",
"server": "",
"client": "944adbf8a09f6b55",
"x": 960,
"y": 1380,
"wires": [
[]
]
},
{
"id": "9865bc2d7ef29571",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/activities/info",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 880,
"y": 280,
"wires": [
[
"387feb57279c6081"
]
]
},
{
"id": "9559d0d72d116929",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/activities/info",
"func": "/*\nhttp://x.x.x.x:8080/activities/info\n{\n\t\"scheduledActivity\" : \"MowingPlannerActivity\",\n\t\"userActivity\" : \"\"\n}\n*/\n\nreturn [[\n{\n payload: {\n unique_id: 'toadi_activities_info_scheduled_activity',\n name: 'Toadi Activities Scheduled Activity',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:calendar-clock-outline',\n value_template: '{{ value_json.scheduledActivity }}'\n },\n topic: 'homeassistant/sensor/toadi_activities_info_scheduled_activity/config'\n},{\n payload: {\n unique_id: 'toadi_activities_info_user_activity',\n name: 'Toadi Activities User Activity',\n device: msg.toadi_device,\n state_topic: 'Toadi'+msg.endpoint,\n icon: 'mdi:account-check-outline',\n value_template: '{{ value_json.userActivity }}'\n },\n topic: 'homeassistant/sensor/toadi_activities_info_user_activity/config'\n}\n]];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2380,
"y": 360,
"wires": [
[
"8340aa773f294d7b"
]
]
},
{
"id": "22191774d5f18db7",
"type": "mqtt in",
"z": "76106b40e1ce3c2f",
"name": "Toadi/system/emergencyStop/set",
"topic": "Toadi/system/emergencyStop/set",
"qos": "2",
"datatype": "auto",
"broker": "2e41d93bbc757522",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 150,
"y": 1200,
"wires": [
[
"d4e733e9c7c4fda3"
]
]
},
{
"id": "7d4f818461d1c5db",
"type": "switch",
"z": "76106b40e1ce3c2f",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "ON",
"vt": "str"
},
{
"t": "eq",
"v": "OFF",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 850,
"y": 1200,
"wires": [
[
"3665fd341eac0f03"
],
[
"d8d6367242e3f62d"
]
]
},
{
"id": "7a68e2357ddc40b8",
"type": "http request",
"z": "76106b40e1ce3c2f",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": true,
"x": 1430,
"y": 1200,
"wires": [
[]
]
},
{
"id": "d4e733e9c7c4fda3",
"type": "change",
"z": "76106b40e1ce3c2f",
"name": "set flowType",
"rules": [
{
"t": "set",
"p": "flowType",
"pt": "msg",
"to": "switch",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 410,
"y": 1200,
"wires": [
[
"04a16c61b97c0c48"
]
]
},
{
"id": "3665fd341eac0f03",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/navigation/hardEmergencyStop",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1110,
"y": 1160,
"wires": [
[
"7a68e2357ddc40b8"
]
]
},
{
"id": "d8d6367242e3f62d",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "/navigation/releaseEmergencyStop",
"func": "msg.url = msg.toadi_uri + node.name;\nmsg.topic = 'Toadi' + node.name;\nmsg.endpoint = node.name;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1120,
"y": 1240,
"wires": [
[
"7a68e2357ddc40b8"
]
]
},
{
"id": "04a16c61b97c0c48",
"type": "function",
"z": "76106b40e1ce3c2f",
"name": "configuration",
"func": "//Configuration\nvar toadi = {\n ip: 'x.x.x.x',\n serial: 'TOADI000001792',\n mac: 'e8:4f:25:ed:d1:51',\n custom_name: 'Toadi'\n};\n\nmsg.toadi_uri = 'http://'+toadi.ip+':8080';\nmsg.toadi_device = {\n configuration_url: 'http://'+toadi.ip+':8080/',\n identifiers: toadi.serial,\n connections: [\n [\n \"mac\",\n toadi.mac\n ]\n ],\n manufacturer: \"Eeve\",\n name: toadi.name,\n suggested_area: \"Garden\",\n model: \"Toadi\",\n via_device: \"Node Red\"\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 540,
"wires": [
[
"7e5b6ed9d9f24c8b"
]
]
},
{
"id": "2e41d93bbc757522",
"type": "mqtt-broker",
"name": "HA Mosquitto",
"broker": "192.168.1.5",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
},
{
"id": "944adbf8a09f6b55",
"type": "websocket-client",
"path": "ws://x.x.x.x/logs/follow",
"tls": "",
"wholemsg": "false",
"hb": "0",
"subprotocol": ""
}
]
@rmeekers
Copy link
Author

rmeekers commented Mar 30, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment