Domoticz Android TV integration using adb tcpip connection and NodeRed

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

Post Reply
xury
Posts: 48
Joined: Monday 10 December 2018 23:32
Target OS: Linux
Domoticz version:
Location: Poland
Contact:

Domoticz Android TV integration using adb tcpip connection and NodeRed

Post by xury »

Hi.
I wanted to present my way of integrating Domoticz with Android TV.
I spent a lot of time looking for a solution and did not find it so I decided to create my own.
The only thing I found is a connection via adb shell to Android TV.
To make this possible, the TV programming options and USB debugging should be unlocked.
Usb debuging must be enabled in you want use adb through wireless or wired network connection.
If you want turn ON you should be use wired connection for WoL feature.
On TV you need confirm agreement when you connect with adb for first time.
Also you need to have node red, adb and etherwake installed on you server.

Code: Select all

apt-get install adb etherwake
And these aplications must be in your PATH for exec node.
For info about node red installation you can go to domoticz wiki page.
I use Debian Buster on the X86 machine, but I think it should work on raspbinan as well.
I not use a Domoticz virtual switches for remote control, but is easy to implement.
I use nora with google home mini for it.
Using this flow I can renmote control Android TV and also start some apps as VLC with my camera when someone pushing doorbel button.
Obviously VLC must be installed on TV.
I use TCL 65EP640, but it should be work with other models too.
Of course you need adopt IP, streams settings etc. for your own conditions.
On comment node is plenty of useful links with knowledge how to use adb.
tcladb.png
tcladb.png (129.46 KiB) Viewed 2900 times

Code: Select all

[
    {
        "id": "739eac25.dc37a4",
        "type": "tab",
        "label": "TCL",
        "disabled": false,
        "info": ""
    },
    {
        "id": "8a3d346a.a7fdd8",
        "type": "comment",
        "z": "739eac25.dc37a4",
        "name": "Baza wiedzy o ADB",
        "info": "https://developer.amazon.com/es/docs/catalog/test-launcher-integration-with-adb.html\nhttps://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8\n\nhttps://www.growingwiththeweb.com/2014/01/handy-adb-commands-for-android.html\nhttps://developer.android.com/studio/command-line/adb\nhttp://android.magicer.xyz/tools/help/shell.html\nhttps://developer.android.com/reference/android/view/KeyEvent\n\nadb-shell-input-events\nhttps://stackoverflow.com/questions/7789826/adb-shell-input-events\n\nDesbloquear pantalla\nhttps://stackoverflow.com/questions/29072501/how-to-unlock-android-phone-through-adb\nadb shell input keyevent 82 && adb shell input keyevent 66\n\nCapturar pantalla\nhttps://stackoverflow.com/questions/27766712/using-adb-to-capture-the-screen\n\nhttps://github.com/mattwilson1024/android-pattern-unlock/blob/master/unlock.sh\n\nPara capturar eventos\nhttps://www.softteco.com/blog/android-writing-events-low-level-touch-screen-automated-shell-test-part-1/\n\ndesbloquear pantalla\nadb shell \"input keyevent 82 ; input swipe 80 880 80 380 ; screencap -p /sdcard/screencap.png\" ; adb pull /sdcard/screencap.png ; convert screencap.png -quality 70 -resize 50% screencap.jpg\n\nBoton home????\nadb shell -n am start -a android.intent.action.MAIN -c android.intent.category.HOME\n\n\n¿otra forma de enviar eventos?\nhttps://www.softteco.com/blog/android-decoding-click-low-level-event/\n\nlanzar aplicaciones\nhttps://medium.com/@xabaras/starting-an-activity-via-adb-47119bdf514f\nadb shell am start -a <signin_intent_action>  -n <signin_component> -f <signin_intent_flags> -d <content_uri>\nadb shell monkey -p com.android.settings -c android.intent.category.LAUNCHER 1\n\nCompresion imagenes\nhttps://stackoverflow.com/questions/19153122/image-compression-tools-via-command-line\n\nCodigos teclado\nhttps://stackoverflow.com/questions/11768356/need-table-of-key-codes-for-android-and-presenter\n0 KEYCODE_UNKNOWN\n1 KEYCODE_MENU\n2 KEYCODE_SOFT_RIGHT\n3 KEYCODE_HOME\n4 KEYCODE_BACK\n5 KEYCODE_CALL\n6 KEYCODE_ENDCALL\n\n7 KEYCODE_0\n8 KEYCODE_1\n9 KEYCODE_2\n10 KEYCODE_3\n11 KEYCODE_4\n12 KEYCODE_5\n13 KEYCODE_6\n14 KEYCODE_7\n15 KEYCODE_8\n16 KEYCODE_9\n\n17 KEYCODE_STAR\n18 KEYCODE_POUND\n\n19 KEYCODE_DPAD_UP\n20 KEYCODE_DPAD_DOWN\n21 KEYCODE_DPAD_LEFT\n22 KEYCODE_DPAD_RIGHT\n23 KEYCODE_DPAD_CENTER\n24 KEYCODE_VOLUME_UP\n25 KEYCODE_VOLUME_DOWN\n\n26 KEYCODE_POWER\n27 KEYCODE_CAMERA\n28 KEYCODE_CLEAR\n\n29 KEYCODE_A\n30 KEYCODE_B\n31 KEYCODE_C\n32 KEYCODE_D\n33 KEYCODE_E\n34 KEYCODE_F\n35 KEYCODE_G\n36 KEYCODE_H\n37 KEYCODE_I\n38 KEYCODE_J\n39 KEYCODE_K\n40 KEYCODE_L\n41 KEYCODE_M\n42 KEYCODE_N\n43 KEYCODE_O\n44 KEYCODE_P\n45 KEYCODE_Q\n46 KEYCODE_R\n47 KEYCODE_S\n48 KEYCODE_T\n49 KEYCODE_U\n50 KEYCODE_V\n51 KEYCODE_W\n52 KEYCODE_X\n53 KEYCODE_Y\n54 KEYCODE_Z\n\n55 KEYCODE_COMMA\n56 KEYCODE_PERIOD\n57 KEYCODE_ALT_LEFT\n58 KEYCODE_ALT_RIGHT\n59 KEYCODE_SHIFT_LEFT\n60 KEYCODE_SHIFT_RIGHT\n\n61 KEYCODE_TAB\n62 KEYCODE_SPACE\n63 KEYCODE_SYM\n64 KEYCODE_EXPLORER\n65 KEYCODE_ENVELOPE\n\n66 KEYCODE_ENTER\n67 KEYCODE_DEL\n68 KEYCODE_GRAVE\n69 KEYCODE_MINUS\n\n70 KEYCODE_EQUALS\n71 KEYCODE_LEFT_BRACKET\n72 KEYCODE_RIGHT_BRACKET\n73 KEYCODE_BACKSLASH\n74 KEYCODE_SEMICOLON\n75 KEYCODE_APOSTROPHE\n76 KEYCODE_SLASH\n77 KEYCODE_AT\n78 KEYCODE_NUM\n79 KEYCODE_HEADSETHOOK\n80 KEYCODE_FOCUS\n81 KEYCODE_PLUS\n\n82 KEYCODE_MENU\n83 KEYCODE_NOTIFICATION\n84 KEYCODE_SEARCH\n85 TAG_LAST_KEYCODE\n\n\n\nandroid adb commands Nibiru Launcher Override \n*some of these work with root access only\n\n// shop device ip address\nadb shell ip addr show\n// or \nadb shell ip addr show wlan0\n\n// take screenshot and save file to users folder (on pc, C:\\Users\\username)\n$ adb shell \"screencap -p\" | sed 's/\\r$//' > screen.png\n// https://stackpointer.io/mobile/android-screen-capture-using-adb/525/\n\n// send key commands\nhttps://stackoverflow.com/questions/7789826/adb-shell-input-events\n\nview logcat\n> adb logcat\nlogcat with only lines with these words\n> adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG\n\nget list of activities (look for launcher see, android.intent.category.HOME)\n> adb shell dumpsys activity\n\nopen wifi settings menu from commandline\n> adb shell am start -a android.intent.action.MAIN -n com.android.settings/.Settings\n\nenable/disable wifi from adb\n> adb shell svc wifi enable\n\nreboot from commandline\n> adb reboot\n\nremove default launcher from nibiru vr phone\n> adb shell\n> pm block com.nibiru.launcher3d\n\nre-enable\n> adb shell\n> pm unblock com.nibiru.launcher3d\n\nrun app from adb shell (1 is main activity)\n> monkey -p com.package.name 1\n\nmodify net config (to connect automatically into certain ssid)\n> adb pull /data/misc/wifi/wpa_supplicant.conf\nedit conf\n> adb push wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf\n\n\nProblems\n- Phone starts and stuck in startup image: Do you have any launcher apps?\n- Cannot start wifi (after editing config file) : set owner and permissions to conf file:\n> adb shell chown system.wifi /data/misc/wifi/wpa_supplicant.conf\n> adb shell chmod 660 /data/misc/wifi/wpa_supplicant.conf\n- \"Error: java.lang.SecurityException: Permission Denial: attempt to change component state\": run as root> adb root",
        "x": 1030,
        "y": 360,
        "wires": []
    },
    {
        "id": "69d3ac6c.581094",
        "type": "exec",
        "z": "739eac25.dc37a4",
        "command": "adb -e shell",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "9",
        "oldrc": false,
        "name": "adb shell",
        "x": 1020,
        "y": 500,
        "wires": [
            [],
            [],
            [
                "f16158cb.4686c8",
                "c42de41b.973a38"
            ]
        ]
    },
    {
        "id": "de29cc03.b2a61",
        "type": "change",
        "z": "739eac25.dc37a4",
        "name": "x,y",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"input tap \" & msg.req.query.x & \" \" & msg.req.query.y",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 560,
        "wires": [
            [
                "69d3ac6c.581094"
            ]
        ]
    },
    {
        "id": "ac8f70dc.c1e88",
        "type": "change",
        "z": "739eac25.dc37a4",
        "name": "cmd",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"am start \" & msg.payload",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 680,
        "wires": [
            [
                "69d3ac6c.581094",
                "14dbd174.07033f"
            ]
        ]
    },
    {
        "id": "85c87fa3.88e6a",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "VOLUME_DOWN",
        "topic": "",
        "payload": "KEYCODE_VOLUME_DOWN",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 810,
        "y": 420,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "855186b6.e141b8",
        "type": "change",
        "z": "739eac25.dc37a4",
        "name": "key",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"input keyevent \" & msg.payload",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 520,
        "wires": [
            [
                "69d3ac6c.581094",
                "14dbd174.07033f"
            ]
        ]
    },
    {
        "id": "9501803.002298",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "VOLUME_UP",
        "topic": "",
        "payload": "KEYCODE_VOLUME_UP",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 790,
        "y": 380,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "16ebbadc.03c865",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "CHANNEL_DOWN",
        "topic": "",
        "payload": "KEYCODE_CHANNEL_DOWN",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 370,
        "y": 540,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "59c20b90.cca174",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "CHANNEL_UP",
        "topic": "",
        "payload": "KEYCODE_CHANNEL_UP",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 380,
        "y": 580,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "88dfc0a8.adc25",
        "type": "exec",
        "z": "739eac25.dc37a4",
        "command": "adb",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "3",
        "oldrc": false,
        "name": "adb",
        "x": 1290,
        "y": 760,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "f02a80aa.0d63",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "connect adb",
        "topic": "",
        "payload": " connect 192.168.22.202",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 1090,
        "y": 720,
        "wires": [
            [
                "88dfc0a8.adc25"
            ]
        ]
    },
    {
        "id": "f16158cb.4686c8",
        "type": "function",
        "z": "739eac25.dc37a4",
        "name": "connect",
        "func": "// if was error then reconnect and repeat last command\nif ( msg.payload.code !==0 )\n{\nmsg.payload = \" connect 192.168.22.202 | grep connected\";\nmsg2 = { payload:flow.get('repeat') };\nreturn [msg,msg2];\n}\n",
        "outputs": 2,
        "noerr": 0,
        "x": 1060,
        "y": 600,
        "wires": [
            [
                "88dfc0a8.adc25"
            ],
            [
                "c164661e.44a3d8"
            ]
        ]
    },
    {
        "id": "107abe08.4f9132",
        "type": "exec",
        "z": "739eac25.dc37a4",
        "command": "etherwake -i enp5s0 cc:a1:2b:a0:3f:53 && sleep 0.7 && adb connect 192.168.22.202 &&  sleep 0.4 && adb shell input keyevent ",
        "addpay": true,
        "append": "",
        "useSpawn": "false",
        "timer": "15",
        "oldrc": false,
        "name": "etherwake",
        "x": 1090,
        "y": 780,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "365efbfd.b56ef4",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Power ON",
        "topic": "",
        "payload": "KEYCODE_POWER",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 780,
        "y": 840,
        "wires": [
            [
                "5b3675a0.13be6c"
            ]
        ]
    },
    {
        "id": "a5102c12.5ffcc",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Lewo",
        "topic": "",
        "payload": "KEYCODE_DPAD_LEFT",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 620,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "55837d4f.7b18f4",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Prawo",
        "topic": "",
        "payload": "KEYCODE_DPAD_RIGHT",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 660,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "ebc0a302.79ead",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Góra",
        "topic": "",
        "payload": "KEYCODE_DPAD_UP",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 700,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "8a794a4.c3aacb8",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Dół",
        "topic": "",
        "payload": "KEYCODE_DPAD_DOWN",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 740,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "31695612.dec14a",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "OK",
        "topic": "",
        "payload": "KEYCODE_DPAD_CENTER",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 780,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "9a406c1f.dc0e4",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "info",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "info",
        "onvalue": "165",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 420,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "829c5c39.2d495",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "TV on",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "power",
        "onvalue": "KEYCODE_POWER",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 790,
        "y": 800,
        "wires": [
            [
                "5b3675a0.13be6c"
            ]
        ]
    },
    {
        "id": "3613838.76a777c",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "Guide",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "index",
        "onvalue": "4001",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 460,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "9288912.a23337",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "channel down",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "ch_down",
        "onvalue": "\"KEYCODE_CHANNEL_DOWN\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 550,
        "y": 540,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "4c4a8c8c.ba2684",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "channel up",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "ch_up",
        "onvalue": "\"KEYCODE_CHANNEL_UP\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 540,
        "y": 580,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "51cf6c2a.08c6b4",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "Back",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "cancel",
        "onvalue": "4",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 500,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "50a42c9a.f2e1a4",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "enter tv",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "enter",
        "onvalue": "\"KEYCODE_DPAD_CENTER\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 780,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "6c33c8db.44ddc8",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "dpad up",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "up",
        "onvalue": "\"KEYCODE_DPAD_UP\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 540,
        "y": 700,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "a98dcd2a.8ae0a",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "dpad down",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "down",
        "onvalue": "\"KEYCODE_DPAD_DOWN\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 540,
        "y": 740,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "d64d2028.10412",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "left tv",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "left",
        "onvalue": "\"KEYCODE_DPAD_LEFT\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 620,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "18b070cf.c893af",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "right tv",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "right",
        "onvalue": "\"KEYCODE_DPAD_RIGHT\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 660,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "dd438abd.bb02f8",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "home",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "",
        "onvalue": "3",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 380,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "d77601c1.15598",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "exit",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "",
        "onvalue": "4095",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 820,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "cdd34e7b.9dcb9",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "kamera",
        "topic": "",
        "payload": "-a android.intent.action.VIEW -d -n com.rcreations.ipcamviewer/.WebCamViewerActivity",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 980,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "7f150b3c.9eef84",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Home",
        "topic": "",
        "payload": "3",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 380,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "6489fd28.d9d0c4",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Exit",
        "topic": "",
        "payload": "4095",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 820,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "808d4c0c.23185",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Info",
        "topic": "",
        "payload": "165",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 420,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "6cb823fc.feef1c",
        "type": "exec",
        "z": "739eac25.dc37a4",
        "command": "lsof -i -P -n | grep 192.168.22.202:5555",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "5",
        "oldrc": false,
        "name": "check connction",
        "x": 820,
        "y": 900,
        "wires": [
            [],
            [],
            [
                "fd69e444.2fba38"
            ]
        ]
    },
    {
        "id": "d4de92dd.4affc",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "every 1m",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "x": 630,
        "y": 900,
        "wires": [
            [
                "6cb823fc.feef1c"
            ]
        ]
    },
    {
        "id": "fd69e444.2fba38",
        "type": "function",
        "z": "739eac25.dc37a4",
        "name": "count",
        "func": "if ( msg.payload.code !== 0 )\n{\nmsg.payload = \" connect 192.168.22.202 | grep connected\";\nvar count = flow.get('count')||0;\ncount += 1;\n// store the value back\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn [msg,null];\n}\nelse {\ncount = 0;\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.count = count;\nreturn [null,msg];\n}\n",
        "outputs": 2,
        "noerr": 0,
        "x": 990,
        "y": 900,
        "wires": [
            [
                "88dfc0a8.adc25",
                "a2fd2a9f.68a5b8"
            ],
            [
                "a2fd2a9f.68a5b8"
            ]
        ]
    },
    {
        "id": "14dbd174.07033f",
        "type": "function",
        "z": "739eac25.dc37a4",
        "name": "repeat set",
        "func": "// Last command store for repat after connection error\n//var count = flow.get('count')||0;\n//if ( count !==0 ) {\n flow.set('repeat',msg.payload);   \n//}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 800,
        "y": 620,
        "wires": [
            []
        ]
    },
    {
        "id": "c164661e.44a3d8",
        "type": "delay",
        "z": "739eac25.dc37a4",
        "name": "",
        "pauseType": "delay",
        "timeout": "400",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1050,
        "y": 660,
        "wires": [
            [
                "69d3ac6c.581094"
            ]
        ]
    },
    {
        "id": "8d07c0b9.ca068",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "TV Off",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "power",
        "onvalue": "\"KEYCODE_POWER\"",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 790,
        "y": 720,
        "wires": [
            [
                "69d3ac6c.581094"
            ]
        ]
    },
    {
        "id": "3378b07b.4088",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Power Off",
        "topic": "",
        "payload": "KEYCODE_POWER",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 780,
        "y": 760,
        "wires": [
            [
                "69d3ac6c.581094"
            ]
        ]
    },
    {
        "id": "5b3675a0.13be6c",
        "type": "function",
        "z": "739eac25.dc37a4",
        "name": "Check On",
        "func": "// checkin TV already ON\n// preventing unneeded Off\nvar count = flow.get('count')||0;\nif ( count !== 0 ) {\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 940,
        "y": 780,
        "wires": [
            [
                "107abe08.4f9132"
            ]
        ]
    },
    {
        "id": "7df11d30.c2ea14",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Source",
        "topic": "",
        "payload": "-a android.intent.action.VIEW -d -n com.tcl.sourcemananger/com.tcl.sourcemanager.MainActivity",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 940,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "a2fd2a9f.68a5b8",
        "type": "function",
        "z": "739eac25.dc37a4",
        "name": "To domoticz",
        "func": "// domoticz TV status indicator\n// swithchtype contact\nmsg.payload = {};\n    msg.payload.command = \"switchlight\"\n    msg.payload.idx = 201;\n    //msg.payload.nvalue = 0;\nif ( msg.count === 0 ) {\n    \n    msg.payload.switchcmd = \"On\";   \n}\nelse {\n    msg.payload.switchcmd = \"Off\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1150,
        "y": 900,
        "wires": [
            [
                "e7cc889.cb31478"
            ]
        ]
    },
    {
        "id": "1059f391.03785c",
        "type": "mqtt out",
        "z": "739eac25.dc37a4",
        "name": "",
        "topic": "domoticz/in",
        "qos": "2",
        "retain": "false",
        "broker": "9748a36f.44bdd",
        "x": 1270,
        "y": 820,
        "wires": []
    },
    {
        "id": "e7cc889.cb31478",
        "type": "json",
        "z": "739eac25.dc37a4",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 1290,
        "y": 900,
        "wires": [
            [
                "1059f391.03785c"
            ]
        ]
    },
    {
        "id": "47ee0b65.567934",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Guide",
        "topic": "",
        "payload": "4001",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 460,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "68a7a0f5.9ccbf",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Back",
        "topic": "",
        "payload": "4",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 410,
        "y": 500,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "45164038.2ba51",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "sw do TV",
        "topic": "",
        "payload": "-a android.intent.action.VIEW -d -n com.tcl.tv/.TVActivity",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 400,
        "y": 900,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "89264521.6ec2f8",
        "type": "delay",
        "z": "739eac25.dc37a4",
        "name": "",
        "pauseType": "delay",
        "timeout": "8",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 680,
        "y": 1000,
        "wires": [
            [
                "c1a5d4d0.e620f8"
            ]
        ]
    },
    {
        "id": "c1a5d4d0.e620f8",
        "type": "template",
        "z": "739eac25.dc37a4",
        "name": "exit  after 8 sec",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "plain",
        "template": "4",
        "output": "str",
        "x": 820,
        "y": 960,
        "wires": [
            [
                "855186b6.e141b8"
            ]
        ]
    },
    {
        "id": "c42de41b.973a38",
        "type": "debug",
        "z": "739eac25.dc37a4",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 1190,
        "y": 520,
        "wires": []
    },
    {
        "id": "6c4491d0.ea94b",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "Camera on TV",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "",
        "onvalue": "-a android.intent.action.VIEW -d rtsp://login:[email protected]:554/Streaming/Channels/101 -n org.videolan.vlc/.StartActivity",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 608.8888549804688,
        "y": 962.22216796875,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "89c08297.26044",
        "type": "link in",
        "z": "739eac25.dc37a4",
        "name": "Od dzwonka",
        "links": [
            "23d82726.112eb8"
        ],
        "x": 455,
        "y": 1060,
        "wires": [
            [
                "849f3249.97bd8"
            ]
        ]
    },
    {
        "id": "849f3249.97bd8",
        "type": "template",
        "z": "739eac25.dc37a4",
        "name": "Od dzwonka",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "plain",
        "template": "-a android.intent.action.VIEW -d rtsp://login:[email protected]:554/Streaming/Channels/101 -n org.videolan.vlc/.StartActivity",
        "output": "str",
        "x": 590,
        "y": 1060,
        "wires": [
            [
                "89264521.6ec2f8",
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "a04ca23b.7d3a1",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Kamera vlc",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 400,
        "y": 1020,
        "wires": [
            [
                "849f3249.97bd8"
            ]
        ]
    },
    {
        "id": "ed665ad7.081f28",
        "type": "inject",
        "z": "739eac25.dc37a4",
        "name": "Netflix",
        "topic": "",
        "payload": "-a android.intent.action.VIEW -d -n com.netflix.ninja/.MainActivity",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 390,
        "y": 860,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "e7095956.eafc08",
        "type": "nora-scene",
        "z": "739eac25.dc37a4",
        "devicename": "Netflix",
        "roomhint": "",
        "scenereversible": false,
        "name": "",
        "nora": "4aa17da2.220c54",
        "topic": "",
        "onvalue": "-a android.intent.action.VIEW -d -n com.netflix.ninja/.MainActivity",
        "onvalueType": "str",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 530,
        "y": 860,
        "wires": [
            [
                "ac8f70dc.c1e88"
            ]
        ]
    },
    {
        "id": "4aa17da2.220c54",
        "type": "nora-config",
        "z": "",
        "name": "nora config",
        "group": "",
        "notify": false
    },
    {
        "id": "9748a36f.44bdd",
        "type": "mqtt-broker",
        "z": "",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest