Skip to content

Instantly share code, notes, and snippets.

@Breakerz
Last active January 29, 2020 02:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Breakerz/3006e130176168efc2412fd85ad034ac to your computer and use it in GitHub Desktop.
Save Breakerz/3006e130176168efc2412fd85ad034ac to your computer and use it in GitHub Desktop.
Home Assistant 📡 > Android TV 📺> Cam 🎥
camera:
- platform: local_file
name : shield
file_path: /config/www/nvidia_screen.png
[
{
"id": "2aa9bdb.8d58742",
"type": "api-call-service",
"z": "84be3fba.588ae",
"name": "ScreenShot",
"server": "4b87e078.1ca048",
"version": 1,
"debugenabled": false,
"service_domain": "androidtv",
"service": "adb_command",
"entityId": "",
"data": "{\"entity_id\":\"media_player.nvidia_shield\",\"command\":\"screencap -p > /sdcard/temp/screen.png\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 1150,
"y": 40,
"wires": [
[
"2a0ef006.11c5f"
]
]
},
{
"id": "2a0ef006.11c5f",
"type": "api-call-service",
"z": "84be3fba.588ae",
"name": "Download ScreenShot",
"server": "4b87e078.1ca048",
"version": 1,
"debugenabled": false,
"service_domain": "androidtv",
"service": "download",
"entityId": "",
"data": "{\"entity_id\":\"media_player.nvidia_shield\",\"device_path\":\"/sdcard/temp/screen.png\",\"local_path\":\"/config/www/nvidia_screen.png\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 1360,
"y": 40,
"wires": [
[]
]
},
{
"id": "2c1f5dec.367082",
"type": "server-state-changed",
"z": "84be3fba.588ae",
"name": "",
"server": "4b87e078.1ca048",
"version": 1,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "media_player.nvidia_shield",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "playing",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"x": 200,
"y": 40,
"wires": [
[
"fec41315.ec7d7"
],
[
"fec41315.ec7d7"
]
]
},
{
"id": "fec41315.ec7d7",
"type": "api-render-template",
"z": "84be3fba.588ae",
"name": "Playing... but not Netflix, Disney, etc",
"server": "4b87e078.1ca048",
"template": "{{ \nis_state('media_player.nvidia_shield', 'playing') \nand \n(\n is_state_attr('media_player.nvidia_shield', 'source', 'com.plexapp.android')\n or \n is_state_attr('media_player.nvidia_shield', 'source', 'Netflix') \n)\n}}",
"resultsLocation": "payload",
"resultsLocationType": "msg",
"templateLocation": "template",
"templateLocationType": "msg",
"x": 540,
"y": 40,
"wires": [
[
"1813a110.36d25f"
]
]
},
{
"id": "1813a110.36d25f",
"type": "switch",
"z": "84be3fba.588ae",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "True",
"vt": "str"
},
{
"t": "eq",
"v": "False",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 750,
"y": 40,
"wires": [
[
"dc4cc96b.854978"
],
[
"7ba55ef1.565b6"
]
]
},
{
"id": "dc4cc96b.854978",
"type": "looptimer",
"z": "84be3fba.588ae",
"duration": "30",
"units": "Second",
"maxloops": "10000",
"maxtimeout": "2",
"maxtimeoutunits": "Hour",
"name": "",
"x": 960,
"y": 40,
"wires": [
[
"2aa9bdb.8d58742"
],
[]
]
},
{
"id": "7ba55ef1.565b6",
"type": "template",
"z": "84be3fba.588ae",
"name": "STOP",
"field": "Payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "STOP",
"output": "str",
"x": 870,
"y": 100,
"wires": [
[
"dc4cc96b.854978"
]
]
},
{
"id": "4b87e078.1ca048",
"type": "server",
"z": "",
"name": "hassio",
"legacy": false,
"hassio": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true
}
][
{
"id": "2aa9bdb.8d58742",
"type": "api-call-service",
"z": "84be3fba.588ae",
"name": "ScreenShot",
"server": "4b87e078.1ca048",
"version": 1,
"debugenabled": false,
"service_domain": "androidtv",
"service": "adb_command",
"entityId": "",
"data": "{\"entity_id\":\"media_player.nvidia_shield\",\"command\":\"screencap -p > /sdcard/temp/screen.png\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 1150,
"y": 40,
"wires": [
[
"2a0ef006.11c5f"
]
]
},
{
"id": "2a0ef006.11c5f",
"type": "api-call-service",
"z": "84be3fba.588ae",
"name": "Download ScreenShot",
"server": "4b87e078.1ca048",
"version": 1,
"debugenabled": false,
"service_domain": "androidtv",
"service": "download",
"entityId": "",
"data": "{\"entity_id\":\"media_player.nvidia_shield\",\"device_path\":\"/sdcard/temp/screen.png\",\"local_path\":\"/config/www/nvidia_screen.png\"}",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 1360,
"y": 40,
"wires": [
[]
]
},
{
"id": "2c1f5dec.367082",
"type": "server-state-changed",
"z": "84be3fba.588ae",
"name": "",
"server": "4b87e078.1ca048",
"version": 1,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "media_player.nvidia_shield",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "playing",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 2,
"output_only_on_state_change": true,
"x": 200,
"y": 40,
"wires": [
[
"fec41315.ec7d7"
],
[
"fec41315.ec7d7"
]
]
},
{
"id": "fec41315.ec7d7",
"type": "api-render-template",
"z": "84be3fba.588ae",
"name": "Playing... but not Netflix, Disney, etc",
"server": "4b87e078.1ca048",
"template": "{{ \nis_state('media_player.nvidia_shield', 'playing') \nand \n(\n is_state_attr('media_player.nvidia_shield', 'source', 'com.plexapp.android')\n or \n is_state_attr('media_player.nvidia_shield', 'source', 'Netflix') \n)\n}}",
"resultsLocation": "payload",
"resultsLocationType": "msg",
"templateLocation": "template",
"templateLocationType": "msg",
"x": 540,
"y": 40,
"wires": [
[
"1813a110.36d25f"
]
]
},
{
"id": "1813a110.36d25f",
"type": "switch",
"z": "84be3fba.588ae",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "True",
"vt": "str"
},
{
"t": "eq",
"v": "False",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 750,
"y": 40,
"wires": [
[
"dc4cc96b.854978"
],
[
"7ba55ef1.565b6"
]
]
},
{
"id": "dc4cc96b.854978",
"type": "looptimer",
"z": "84be3fba.588ae",
"duration": "30",
"units": "Second",
"maxloops": "10000",
"maxtimeout": "2",
"maxtimeoutunits": "Hour",
"name": "",
"x": 960,
"y": 40,
"wires": [
[
"2aa9bdb.8d58742"
],
[]
]
},
{
"id": "7ba55ef1.565b6",
"type": "template",
"z": "84be3fba.588ae",
"name": "STOP",
"field": "Payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "STOP",
"output": "str",
"x": 870,
"y": 100,
"wires": [
[
"dc4cc96b.854978"
]
]
},
{
"id": "4b87e078.1ca048",
"type": "server",
"z": "",
"name": "hassio",
"legacy": false,
"hassio": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment