For use with Home Assistant and Node-RED
[
{
"id": "30fe37ec58ecdd01",
"type": "tab",
"label": "Kodi",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f830844aa35e2bb8",
"type": "server-state-changed",
"z": "30fe37ec58ecdd01",
"name": "Kodi State Change",
"server": "3c34eda7.15dfc2",
"version": 1,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "media_player.kodi_25e41e56ea2ce3036a166c64f9d017ef",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"for": 0,
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"x": 330,
"y": 300,
"wires": [
[
"356a32c09251b6f4"
]
]
},
{
"id": "356a32c09251b6f4",
"type": "switch",
"z": "30fe37ec58ecdd01",
"name": "Is Playing",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "playing",
"vt": "str"
},
{
"t": "neq",
"v": "playing",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 500,
"y": 300,
"wires": [
[
"0b6b3c584e873912"
],
[
"a562acbeb2175c01"
]
]
},
{
"id": "0b6b3c584e873912",
"type": "api-call-service",
"z": "30fe37ec58ecdd01",
"name": "Turn Off Air Purifier",
"server": "3c34eda7.15dfc2",
"version": 1,
"debugenabled": false,
"service_domain": "fan",
"service": "turn_off",
"entityId": "fan.air_purifier",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"output_location": "payload",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 690,
"y": 260,
"wires": [
[]
]
},
{
"id": "a562acbeb2175c01",
"type": "api-call-service",
"z": "30fe37ec58ecdd01",
"name": "Turn On Air Purifier",
"server": "3c34eda7.15dfc2",
"version": 1,
"debugenabled": false,
"service_domain": "fan",
"service": "turn_on",
"entityId": "fan.air_purifier",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"output_location": "payload",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 690,
"y": 340,
"wires": [
[
"04331fddff20341c"
]
]
},
{
"id": "04331fddff20341c",
"type": "api-call-service",
"z": "30fe37ec58ecdd01",
"name": "Set Mode To Auto",
"server": "3c34eda7.15dfc2",
"version": 1,
"debugenabled": false,
"service_domain": "fan",
"service": "set_preset_mode",
"entityId": "fan.air_purifier",
"data": "{\"preset_mode\":\"auto\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "payload",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 910,
"y": 340,
"wires": [
[]
]
},
{
"id": "3c34eda7.15dfc2",
"type": "server",
"name": "Home Assistant",
"legacy": false,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
}
]