Rebootowanie routera po telnecie

Witam. Czy ktoś już coś takiego próbował zrobić w Node-Red?
Mam repeater, który nie obsługuje innego zdalnego logowania.
Z dodatku SSH Web Terminal w HA po uprzednim doinstalowaniu busybox telnet działa.

W Node-Red pobrałem noda telnet, ale nie wiem jak go poprawnie skonfigurować w taki sposób, żeby zaczął się łączyć z repeaterem i zapytał o dane logowania, które następnie podam poprzez funkcje.

Niestety dokumentacja do tego node nie istnieje :slight_smile:

Spróbuj użyć node exec

Nie działa
Screenshot_20220701-162551_Home Assistant

Jaki router posiadasz ?

ssh działa standardowo na porcie 22, poza tym ssh nie przyjmuje hasła w linii komend telnet tez chyba nie. Tu chyba powinno telnet uzytkownik@host 23, albo ssh uzytkownik@host -p 22 'polecenie'

Masz racje, trzeba dorobić sobie klucz, wygenerować go sobie na HA ssh-keygen -t dsa przekopiować na router jeżeli na to pozwala i zaimportować dla danego użytkownika, dla Mikrotik procedura znajduje się tutaj https://youtu.be/-AAL2otYjT4

Rozwiązałem to w ten sposób [ { "id": "fb7b02005aa65a9f", "type": "tab", "label": "Awarie", "disabled": false, "info": "", "env": [] }, { "id": "cd58be90d617c637", "type": "group", "z": "fb7b02005aa65a9f", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "678a740e8d51b2d2", "a2a470664f3ce62e", "7c485639fcbb5441", "2c5593e3fcf85cfc", "62abdbd9c9e75c18", "1f0ca7074d0fb603", "3c2c03d6344d222c", "df5ad3dfc56e47a6", "580e0f06fa9eb184", "3429d671a44c8212", "e359b267aaf40a7d", "9fe778a77602ee9b", "1b16b85c1769350e", "01c25cb14529831a", "d1c75e0d9d7afd47", "88a3c52b1ac544ba", "338dd41c9d928a78", "6659c6a9c35a909d", "d9f40693008c8383", "0f73c4a14a354087", "c7b8a00b35387a20", "d6308f1fb9ba06b9", "df155fc200764b6e", "86567a87e28299e0" ], "x": 34, "y": 39, "w": 2232, "h": 402 }, { "id": "678a740e8d51b2d2", "type": "delay", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1840, "y": 80, "wires": [ [ "2c5593e3fcf85cfc" ] ] }, { "id": "a2a470664f3ce62e", "type": "delay", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "pauseType": "delay", "timeout": "2", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1840, "y": 140, "wires": [ [ "7c485639fcbb5441" ] ] }, { "id": "7c485639fcbb5441", "type": "change", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Pass", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "tu wpisz hasło", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1990, "y": 140, "wires": [ [ "62abdbd9c9e75c18" ] ] }, { "id": "2c5593e3fcf85cfc", "type": "change", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Login", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "tu wpisz login", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1990, "y": 80, "wires": [ [ "62abdbd9c9e75c18" ] ] }, { "id": "62abdbd9c9e75c18", "type": "telnet-send", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "connection": "ab54492bff77f196", "x": 2190, "y": 160, "wires": [] }, { "id": "1f0ca7074d0fb603", "type": "telnet-read", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "connection": "ab54492bff77f196", "x": 110, "y": 400, "wires": [ [ "338dd41c9d928a78" ] ] }, { "id": "3c2c03d6344d222c", "type": "debug", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 870, "y": 400, "wires": [] }, { "id": "df5ad3dfc56e47a6", "type": "change", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "CMD", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "reboot", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1990, "y": 200, "wires": [ [ "62abdbd9c9e75c18" ] ] }, { "id": "580e0f06fa9eb184", "type": "delay", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "pauseType": "delay", "timeout": "3", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1840, "y": 200, "wires": [ [ "df5ad3dfc56e47a6" ] ] }, { "id": "3429d671a44c8212", "type": "change", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Exit", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "exit", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1990, "y": 260, "wires": [ [ "62abdbd9c9e75c18" ] ] }, { "id": "e359b267aaf40a7d", "type": "delay", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "pauseType": "delay", "timeout": "4", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1840, "y": 260, "wires": [ [ "3429d671a44c8212" ] ] }, { "id": "9fe778a77602ee9b", "type": "server-state-changed", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Jeżeli gniazdko od bojlera w piwnicy jest niedostępne", "server": "6eb673d0.397dec", "version": 4, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "switch.bojler_piwnica", "entityidfiltertype": "exact", "outputinitially": false, "state_type": "str", "haltifstate": "unkown", "halt_if_type": "str", "halt_if_compare": "is", "outputs": 2, "output_only_on_state_change": true, "for": "5", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 260, "y": 140, "wires": [ [ "d1c75e0d9d7afd47" ], [] ], "outputLabels": [ "Jest niedostępne", "" ] }, { "id": "1b16b85c1769350e", "type": "server-state-changed", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Jeżeli gniazdko od bojlera w piwnicy jest niedostępne", "server": "6eb673d0.397dec", "version": 4, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "switch.bojler_piwnica", "entityidfiltertype": "exact", "outputinitially": false, "state_type": "str", "haltifstate": "unavailable", "halt_if_type": "str", "halt_if_compare": "is", "outputs": 2, "output_only_on_state_change": true, "for": "5", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 260, "y": 200, "wires": [ [ "d1c75e0d9d7afd47" ], [] ], "outputLabels": [ "Jest niedostępne", "" ] }, { "id": "01c25cb14529831a", "type": "change", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Uruchom ponownie repeater w piwnicy", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "timestamp", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1490, "y": 160, "wires": [ [ "580e0f06fa9eb184", "678a740e8d51b2d2", "a2a470664f3ce62e", "e359b267aaf40a7d", "c7b8a00b35387a20" ] ] }, { "id": "d1c75e0d9d7afd47", "type": "api-current-state", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Czy gniazdko w serwerowni od serwerów jest również niedostępne?", "server": "6eb673d0.397dec", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is_not", "entity_id": "switch.serwery", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 780, "y": 160, "wires": [ [ "01c25cb14529831a" ], [ "88a3c52b1ac544ba" ] ], "outputLabels": [ "Tak", "Nie" ] }, { "id": "88a3c52b1ac544ba", "type": "ha-wait-until", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Czekaj aż będzie dostępne", "server": "6eb673d0.397dec", "version": 1, "outputs": 1, "entityId": "switch.serwery", "entityIdFilterType": "exact", "property": "state", "comparator": "is", "value": "on", "valueType": "str", "timeout": "0", "timeoutType": "num", "timeoutUnits": "seconds", "entityLocation": "data", "entityLocationType": "none", "checkCurrentState": true, "blockInputOverrides": true, "x": 1180, "y": 200, "wires": [ [ "01c25cb14529831a" ] ] }, { "id": "338dd41c9d928a78", "type": "file", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Zapis ostatnich stanów do pliku", "filename": "/share/logs/repeater_reboot.txt", "appendNewline": true, "createDir": true, "overwriteFile": "true", "encoding": "utf8", "x": 330, "y": 400, "wires": [ [ "6659c6a9c35a909d" ] ] }, { "id": "6659c6a9c35a909d", "type": "file in", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Odczyt ostatnich stanów z pliku", "filename": "/share/logs/poprzedni_stan_zapelnienia.txt", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 630, "y": 400, "wires": [ [ "3c2c03d6344d222c" ] ] }, { "id": "d9f40693008c8383", "type": "inject", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "", "props": [ { "p": "payload2", "v": "", "vt": "date" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "20", "topic": "", "x": 430, "y": 340, "wires": [ [ "6659c6a9c35a909d" ] ] }, { "id": "0f73c4a14a354087", "type": "api-call-service", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Powiadom o zrebootowaniu routera", "server": "6eb673d0.397dec", "version": 5, "debugenabled": false, "domain": "notify", "service": "mobile_app_sm_g950f", "areaId": [], "deviceId": [], "entityId": [], "data": "{\"message\":\"Nastąpiło zrebootowanie repeatera w piwnicy\",\"data\":{\"image\":\"/local/images/pixlink.jpg\",\"persistent\":true,\"tag\":\"repeater\",\"actions\":[{\"action\":\"reload\",\"title\":\"OK\"}]}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1580, "y": 280, "wires": [ [] ] }, { "id": "c7b8a00b35387a20", "type": "stoptimer", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "duration": "2", "units": "Minute", "payloadtype": "num", "payloadval": "0", "name": "Opóźnienie", "x": 1490, "y": 220, "wires": [ [ "d6308f1fb9ba06b9" ], [] ] }, { "id": "d6308f1fb9ba06b9", "type": "api-current-state", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Czy gniazdko od bojlera jest już dostępne?", "server": "6eb673d0.397dec", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "switch.bojler_piwnica", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1230, "y": 280, "wires": [ [ "0f73c4a14a354087" ], [ "df155fc200764b6e" ] ], "outputLabels": [ "Tak", "Nie" ] }, { "id": "df155fc200764b6e", "type": "api-call-service", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Powiadom o problemie z ponownym uruchomieniem repeatera", "server": "6eb673d0.397dec", "version": 5, "debugenabled": false, "domain": "notify", "service": "mobile_app_sm_g950f", "areaId": [], "deviceId": [], "entityId": [], "data": "{\"message\":\"Gniazdka w piwnicy offline od 10min. Problem z rebootem repeatera!\",\"data\":{\"image\":\"/local/images/pixlink.jpg\",\"persistent\":true,\"tag\":\"repeater\",\"chanel\":\"warnings\",\"actions\":[{\"action\":\"reload\",\"title\":\"OK\"}]}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1670, "y": 340, "wires": [ [] ] }, { "id": "86567a87e28299e0", "type": "comment", "z": "fb7b02005aa65a9f", "g": "cd58be90d617c637", "name": "Rebootowanie repeatera w piwnicy, gdy gniazdka nie chcą się z nim połączyć", "info": "", "x": 330, "y": 80, "wires": [] }, { "id": "ab54492bff77f196", "type": "telnet-connection", "name": "", "address": "192.168.254.8", "port": "23", "inDelimiter": "", "outDelimiter": "", "timeOut": "", "clearOut": "", "openTries": "1" }, { "id": "6eb673d0.397dec", "type": "server", "name": "Home Assistant", "version": 2, "addon": true, "rejectUnauthorizedCerts": true, "ha_boolean": "y|yes|true|on|home|open", "connectionDelay": true, "cacheJson": true, "heartbeat": false, "heartbeatInterval": 30 } ]