Geräte ersetzen in HG's

Da es sich ja um eine Notfall-Funktion handelt, würde es ja auch schon ausreichen, wenn diese nur in der webapp verfügbar wäre :man_shrugging: So eine Funktion in der App gelöst (ohne Umweg über node-red) wäre sicher für Viele noch wünschenswert.
Aber vllt bekommt ihr ja noch ein komprimiertes Script hin, dass es für die breite Maße noch einfacher wird :wink:

Mir hilft die Funktion auf jeden Fall wöchentlich :wink: @Steffen, da die heu Dimmer bei mir regelmäßig ausfallen :roll_eyes:

1 „Gefällt mir“

Jetzt ist es soweit. Hier wie angekündigt die Möglichkeit des Gerätetausches von @Micha über die iobroker-VIS.
Zuerst die Nodes für NR:

[
    {
        "id": "3df32cdd.2bc704",
        "type": "ioBroker in",
        "z": "26afc043.9c075",
        "name": "Change_ID",
        "topic": "0_userdata.0.Change_ID",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "x": 410,
        "y": 640,
        "wires": [
            [
                "4a4a8dd.6246b74"
            ]
        ]
    },
    {
        "id": "4a4a8dd.6246b74",
        "type": "switch",
        "z": "26afc043.9c075",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 550,
        "y": 640,
        "wires": [
            [
                "1e40baf.5d26e45",
                "d2f7ca42.920448",
                "ae013c3b.0c03a"
            ]
        ]
    },
    {
        "id": "1e40baf.5d26e45",
        "type": "ioBroker get",
        "z": "26afc043.9c075",
        "name": "",
        "topic": "0_userdata.0.New_ID",
        "attrname": "payload",
        "payloadType": "value",
        "x": 780,
        "y": 640,
        "wires": [
            [
                "cf78fe39.0733d"
            ]
        ]
    },
    {
        "id": "d2f7ca42.920448",
        "type": "ioBroker get",
        "z": "26afc043.9c075",
        "name": "",
        "topic": "0_userdata.0.Old_ID",
        "attrname": "payload",
        "payloadType": "value",
        "x": 780,
        "y": 700,
        "wires": [
            [
                "463636ff.89d6f8"
            ]
        ]
    },
    {
        "id": "cf78fe39.0733d",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "Schreibe Flow-Variable \"New_ID\"",
        "func": "flow.set('New_ID', Number(msg.payload));",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1080,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "463636ff.89d6f8",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "Schreibe Flow-Variable \"Old_ID\"",
        "func": "flow.set('Old_ID', Number(msg.payload));",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1090,
        "y": 700,
        "wires": [
            []
        ]
    },
    {
        "id": "ae013c3b.0c03a",
        "type": "delay",
        "z": "26afc043.9c075",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 760,
        "y": 760,
        "wires": [
            [
                "780a844b.97f5dc",
                "1ab219a3.3b0aa6"
            ]
        ]
    },
    {
        "id": "b2aa9f56.f6ea9",
        "type": "ioBroker out",
        "z": "26afc043.9c075",
        "name": "",
        "topic": "0_userdata.0.Change_ID",
        "ack": "true",
        "autoCreate": "false",
        "stateName": "",
        "role": "",
        "payloadType": "",
        "readonly": "",
        "stateUnit": "",
        "stateMin": "",
        "stateMax": "",
        "x": 1110,
        "y": 760,
        "wires": []
    },
    {
        "id": "780a844b.97f5dc",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "",
        "func": "msg.payload = \"false\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 920,
        "y": 760,
        "wires": [
            [
                "b2aa9f56.f6ea9"
            ]
        ]
    },
    {
        "id": "1ab219a3.3b0aa6",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "get:all",
        "func": "msg.payload = \"get:all\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 910,
        "y": 820,
        "wires": [
            [
                "fb402403.9f9ca8",
                "fd031dd.29bd2e"
            ]
        ]
    },
    {
        "id": "fb402403.9f9ca8",
        "type": "delay",
        "z": "26afc043.9c075",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 940,
        "y": 880,
        "wires": [
            [
                "436e05db.5afb5c"
            ]
        ]
    },
    {
        "id": "fd031dd.29bd2e",
        "type": "link out",
        "z": "26afc043.9c075",
        "name": "",
        "links": [
            "1e011fe2.7a7eb"
        ],
        "x": 1215,
        "y": 820,
        "wires": []
    },
    {
        "id": "436e05db.5afb5c",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "get HG's",
        "func": "msg.payload = \"get:homeegrams\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1100,
        "y": 880,
        "wires": [
            [
                "fd031dd.29bd2e"
            ]
        ]
    },
    {
        "id": "1e011fe2.7a7eb",
        "type": "link in",
        "z": "26afc043.9c075",
        "name": "",
        "links": [
            "128724a1.40d67b",
            "21aa6862.c77cf8",
            "1ca9a5ca.19b05a",
            "40a012b8.87b2dc",
            "44be2096.ff847",
            "438f3d8b.5f86a4",
            "62a0bc8d.a262c4",
            "56209e5b.431ff",
            "e171b828.c450f8",
            "71226322.a72c3c",
            "7d9c7141.f460d",
            "23bd8876.6a06e8",
            "863f2dc3.315bc",
            "a49916e2.414be8",
            "d1c99ca7.1143d",
            "e0321cbc.dfa79",
            "e66e869c.11bc18",
            "eb2126e3.bca288",
            "45aa79ed.66f1b8",
            "86d6e491.b599e8",
            "691d2286.cf6fdc",
            "230c55d3.25383a",
            "27de74a2.d48abc",
            "e31bd5fd.1c2578",
            "1daf89bc.685f86",
            "d5117a9c.a0b248",
            "e952c0ea.4eae2",
            "26e57ca4.9b11a4",
            "25c3e89c.ba63c8",
            "cce2c966.22b638",
            "84d7eb77.cc06c8",
            "a9d30ecd.ed8c5",
            "66de1386.49630c",
            "ed06967f.c658b8",
            "c7302d0c.4d0bf",
            "ee187633.348248",
            "e0bf69be.cd7158",
            "672fadf9.703ea4",
            "dc72f591.6c6738",
            "947087f4.f851a8",
            "8a106fcf.08e38",
            "44179766.70acf8",
            "46dd7532.5fb1ac",
            "4feeefff.c1d31",
            "44e50a5c.7a2764",
            "8461ef97.a35c4",
            "ab144ad3.651de8",
            "c6849e0e.fa026",
            "f3c77010.422ec",
            "7710d4a7.ee44ec",
            "31eb785b.8d9ed8",
            "7b813e7d.66f3f",
            "a697a15b.5648c",
            "57809562.7524cc",
            "6df1831e.38e78c",
            "214a65cb.2758ca",
            "a016fee0.ad988",
            "fd031dd.29bd2e"
        ],
        "x": 375,
        "y": 80,
        "wires": [
            [
                "f6c24df8.4ec29"
            ]
        ]
    },
    {
        "id": "f6c24df8.4ec29",
        "type": "homeeApi",
        "z": "26afc043.9c075",
        "homee": "",
        "name": "",
        "messageTypeFilter": [],
        "nodeFilter": "",
        "attributeFilter": "",
        "x": 640,
        "y": 80,
        "wires": [
            [
                "19332ee.2ac90d1",
                "1790e618.8cb07a",
                "63217ba6.454644",
                "9492b4bb.9b0458"
            ]
        ]
    },
    {
        "id": "9492b4bb.9b0458",
        "type": "function",
        "z": "26afc043.9c075",
        "name": "Attribute und Node ID ersetzen",
        "func": "var nodeold = flow.get(\"Old_ID\");\nvar nodenew = flow.get(\"New_ID\");\nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\n\nif (Object.keys(msg.payload)[0] === \"homeegrams\"){\nvar hg = msg.payload.homeegrams;\nhg.forEach(function(hgs){\n    hgs.triggers.attribute_triggers.forEach(function(trigger){\n        if (trigger.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})}\n            })\n        }\n    })\n\n    hgs.actions.attribute_actions.forEach(function(action){\n        if (action.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === action.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})}\n            })\n        }\n    })\n    \n    hgs.conditions.attribute_conditions.forEach(function(conditions){\n        if (conditions.node_id == nodeold ){\n            var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})}\n            })\n        }\n    })\n    \n})\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 280,
        "wires": [
            [
                "f6c24df8.4ec29"
            ]
        ]
    }
]

Nur den homee-API-Node durch den eigenen ersetzen.

In den Objekten von iobroker folgende Variablen anlegen:


„Change_ID“ ist Typ bool, die beiden anderen Typ Number.

Hier die iobroker-widgets:

[{"tpl":"i-vis-checkbox","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","iCheckboxCount":"1","iCheckboxOrientation":"vertical","iCheckboxSpacing":"20","iCheckboxIcon":"iIconCheck","iWidth":"30","iHeight":"30","iBackgroundColor":"#ffffff","iBackgroundColorActive":"#14eb19","iColorIcon":"#000000","iCornerRadiusUL":"4","iCornerRadiusUR":"4","iCornerRadiusLR":"4","iCornerRadiusLL":"4","iBorderSize":"0","iBorderStyle":"none","iBorderColor":"#ffffff","iBorderColorActive":"#ffffff","iShadowXOffset":"2","iShadowYOffset":"2","iShadowBlur":"2","iShadowSpread":"0","iShadowColor":"#111111","iShadowColorActive":"#111111","iShadowInnerXOffset":"0","iShadowInnerYOffset":"0","iShadowInnerBlur":"0","iShadowInnerSpread":"0","iShadowInnerColor":"#111111","iShadowInnerColorActive":"#111111","iShadowTextXOffset":"0","iShadowTextYOffset":"0","iShadowTextBlur":"0","iShadowTextColor":"#111111","iShadowTextColorActive":"#111111","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"oid1":"0_userdata.0.Change_ID","iValueFalse1":"false","iValueTrue1":"true","iText1":"Tauschen"},"style":{"left":"261px","top":"302px","width":"124px","height":"30px","font-family":"Jura-Medium"},"widgetSet":"vis-inventwo"},{"tpl":"tplVis-materialdesign-Input","data":{"oid":"0_userdata.0.Old_ID","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"inputType":"number","inputLayout":"solo","showInputMessageAlways":false,"showInputCounter":false,"clearIconShow":false,"signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"inputTextColor":"#ffffff","inputLabelText":"","inputLabelColor":"","inputLayoutBorderColor":"","inputLayoutBackgroundColorHover":"#000060","inputTextFontSize":"24","inputTextFontFamily":"","clearIcon":"","inputAppendixFontSize":"24","inputLabelFontFamily":"","inputLabelFontSize":"","inputTranslateX":"","inputTranslateY":"","inputPrefix":"Alte ID: ","inputAppendixFontFamily":"","inputSuffix":"","inputMessage":"","inputLayoutBackgroundColor":"#000020","inputLayoutBackgroundColorSelected":"#000060","inputMessageFontFamily":"","clearIconColor":"#bbb9b9","visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","inputCounterColor":"","inputMessageColor":"","inputMaxLength":"4","exportData":"true","inputAlignment":"left","inputLayoutBorderColorHover":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.border_hover;dark:vis-materialdesign.0.colors.dark.input.border_hover; mode === \"true\" ? dark : light}","inputLayoutBorderColorSelected":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.border_selected;dark:vis-materialdesign.0.colors.dark.input.border_selected; mode === \"true\" ? dark : light}","inputLabelColorSelected":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.label_selected;dark:vis-materialdesign.0.colors.dark.input.label_selected; mode === \"true\" ? dark : light}","inputAppendixColor":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.appendix;dark:vis-materialdesign.0.colors.dark.input.appendix; mode === \"true\" ? dark : light}","inputMessageFontSize":"{vis-materialdesign.0.fontSizes.input.message}","inputCounterFontSize":"{vis-materialdesign.0.fontSizes.input.counter}","inputCounterFontFamily":"{vis-materialdesign.0.fonts.input.counter}"},"style":{"left":"66px","top":"287px","width":"180px","height":"30px","z-index":"5","font-family":"Jura-Medium"},"widgetSet":"materialdesign"},{"tpl":"tplVis-materialdesign-Input","data":{"oid":"0_userdata.0.New_ID","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"inputType":"number","inputLayout":"solo","showInputMessageAlways":false,"showInputCounter":false,"clearIconShow":false,"signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"inputTextColor":"#ffffff","inputLabelText":"","inputLabelColor":"","inputLayoutBorderColor":"","inputLayoutBackgroundColorHover":"#000060","inputTextFontSize":"24","inputTextFontFamily":"","clearIcon":"","inputAppendixFontSize":"24","inputLabelFontFamily":"","inputLabelFontSize":"","inputTranslateX":"","inputTranslateY":"","inputPrefix":"Neue ID: ","inputAppendixFontFamily":"","inputSuffix":"","inputMessage":"","inputLayoutBackgroundColor":"#000020","inputLayoutBackgroundColorSelected":"#000060","inputMessageFontFamily":"","clearIconColor":"#bbb9b9","visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","inputCounterColor":"","inputMessageColor":"","inputMaxLength":"4","exportData":"true","inputAlignment":"left","inputLayoutBorderColorHover":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.border_hover;dark:vis-materialdesign.0.colors.dark.input.border_hover; mode === \"true\" ? dark : light}","inputLayoutBorderColorSelected":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.border_selected;dark:vis-materialdesign.0.colors.dark.input.border_selected; mode === \"true\" ? dark : light}","inputLabelColorSelected":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.label_selected;dark:vis-materialdesign.0.colors.dark.input.label_selected; mode === \"true\" ? dark : light}","inputAppendixColor":"{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.input.appendix;dark:vis-materialdesign.0.colors.dark.input.appendix; mode === \"true\" ? dark : light}","inputMessageFontSize":"{vis-materialdesign.0.fontSizes.input.message}","inputCounterFontSize":"{vis-materialdesign.0.fontSizes.input.counter}","inputCounterFontFamily":"{vis-materialdesign.0.fonts.input.counter}"},"style":{"left":"66px","top":"317px","width":"180px","height":"30px","z-index":"5","font-family":"Jura-Medium"},"widgetSet":"materialdesign"}]

Der Trigger ist eine Checkbox ist aus den inventwo-Widgets und die Eingabefelder aus materialdesign-Widgets. Es geht aber auch jeder beliebige Toggle-Switch und numerische Eingabefelder.

Bedienung ist einfach beide ID’s wie beschrieben in die Eingabefelder und in der Checkbox den Haken setzen. Der Haken geht nach zwei Sekunden von selber weg und nach weiteren zwei Sekunden sollte das Gerät in den HG’s getauscht sein. Habe es getestet.
Bei Fragen einfach melden.

9 „Gefällt mir“


[
    {
        "id": "8cabd737.459c",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Attribute und Node ID ersetzen bei Trigger , Conditions und Actions ( test nur Node )",
        "func": "var nodeold = parseFloat(global.get(\"old_id\")); // zu ersetzende Node ID\nvar nodenew = parseFloat(global.get(\"new_id\")); // neue Node ID \nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\n\nif (Object.keys(msg.payload)[0] === \"homeegrams\"){\nvar hg = msg.payload.homeegrams;\nhg.forEach(function(hgs){\n    hgs.triggers.attribute_triggers.forEach(function(trigger){\n        if (trigger.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})}\n            })\n        }\n    })\n\n    hgs.actions.attribute_actions.forEach(function(action){\n        if (action.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === action.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})}\n            })\n        }\n    })\n    \n    hgs.conditions.attribute_conditions.forEach(function(conditions){\n        if (conditions.node_id == nodeold ){\n            var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})}\n            })\n        }\n    })\n    \n})\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1050,
        "y": 820,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "ca57b1f5.c8c4b",
        "type": "homeeApi",
        "z": "92bbd3bd.5be8f",
        "homee": "",
        "name": "homeeApi",
        "messageTypeFilter": [],
        "nodeFilter": "",
        "attributeFilter": "",
        "x": 640,
        "y": 820,
        "wires": [
            [
                "8cabd737.459c"
            ]
        ]
    },
    {
        "id": "bc19d08.97e75b",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 300,
        "y": 820,
        "wires": [
            [
                "a9a961ca.6d0798"
            ]
        ]
    },
    {
        "id": "a9a961ca.6d0798",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "func": "msg.payload = \"get:homeegrams\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 820,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "a130206a.75975",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 90,
        "y": 700,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "2e1f57f3.63ed78",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n\n<html>\n    <script>\n    \n    function submitMessage() {\n      alert(\"Wert gespeichert\");\n      setTimeout(function(){ document.location.reload(true; }, 500);   \n    }\n  </script>\n<body>\n    <center>\n   <h1>** Geräte ID in den Homeegrammen tauschen**</h1>\n<form   method = \"POST\" >\n    \n    <input type=\"number\" name=\"old_id\" placeholder=\"alte Node ID\" > {{payload.old_id}}\n    <br><br>\n    <input type=\"number\" name=\"new_id\" placeholder=\"Neue Node ID\"> {{payload.new_id}}\n    <br><br>\n    <br><br>\n    <button type=\"submit\" onclick=\"submitMessage()\">Geräte tauschen</button>\n</form>\n<br><br>\n<a href=\"https://hom.ee\"><strong>homee Website</strong></a>\n<br><br>\n<a href=\"https://community.hom.ee/t/geraete-ersetzen-in-hgs/35555\"><strong>homee Community Thread</strong></a>\n<br><br>\n<iframe width=\"320\" height=\"240\" src=\"https://youtu.be/HamaS_jBWw4\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe><br> <br>\n<iframe style=\"display:none\" name=\"hidden-form\"></iframe>\n</center>\n</body>\n</html>",
        "output": "str",
        "x": 280,
        "y": 700,
        "wires": [
            [
                "5fbf3bef.e1b35c"
            ]
        ]
    },
    {
        "id": "5fbf3bef.e1b35c",
        "type": "http response",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 470,
        "y": 700,
        "wires": []
    },
    {
        "id": "60f51ee9.2347a",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 100,
        "y": 740,
        "wires": [
            [
                "2e1f57f3.63ed78",
                "bc19d08.97e75b",
                "2e4df018.8d71f8",
                "2825c1b.61fe33e"
            ]
        ]
    },
    {
        "id": "2e4df018.8d71f8",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "get:all",
        "output": "str",
        "x": 280,
        "y": 780,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "2825c1b.61fe33e",
        "type": "change",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.old_id",
                "pt": "msg",
                "to": "old_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.new_id",
                "pt": "msg",
                "to": "new_id",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 310,
        "y": 740,
        "wires": [
            []
        ]
    }
]

Hier ein Flow mit einer Eingabeseite.
ip:1880/change aufrufen und dann kann dort die ID des Gerätes eingegeben werden und mit Gerät tauschen wird dann das Gerät ausgetauscht.
Der jeweilige Tausch kann je nach Anzahl der HG und Geräte ein paar Sekunden dauern.
Danach kann das nächste Gerät ausgetauscht werden.

10 „Gefällt mir“

Hammer, Micha!!!
Und das gilt für vhih und normale devices - oder?

Wird die Beta von @stfnhmplr homee Node benötigt?

Geht für jedes Device und es reicht ein normales api node.

2 „Gefällt mir“

Hier eine erweiterte Version wo auf der Eingabeseite die geänderten HG’s und Geräte angezeigt werden und damit dann auch der Vorgang als abgeschlossen angesehen werden kann.

[
    {
        "id": "ca57b1f5.c8c4b",
        "type": "homeeApi",
        "z": "92bbd3bd.5be8f",
        "homee": "",
        "name": "homeeApi",
        "messageTypeFilter": [],
        "nodeFilter": "",
        "attributeFilter": "",
        "x": 640,
        "y": 820,
        "wires": [
            [
                "1e8d4d8a.14c3e2"
            ]
        ]
    },
    {
        "id": "bc19d08.97e75b",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 300,
        "y": 820,
        "wires": [
            [
                "a9a961ca.6d0798"
            ]
        ]
    },
    {
        "id": "a9a961ca.6d0798",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "func": "msg.payload = \"get:homeegrams\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 820,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "a130206a.75975",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 90,
        "y": 680,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "2e1f57f3.63ed78",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n\n<html>\n    <script>\n    \n    function submitMessage() {\n      alert(\"Wert gespeichert\");\n      setTimeout(function(){ document.location.reload(true; }, 500);   \n    }\n  </script>\n<body>\n    <center>\n   <h1>** Geräte ID in den Homeegrammen tauschen**</h1>\n<form   method = \"POST\" >\n    \n    <input type=\"number\" name=\"old_id\" placeholder=\"alte Node ID\" > {{payload.old_id}}\n    <br><br>\n    <input type=\"number\" name=\"new_id\" placeholder=\"Neue Node ID\"> {{payload.new_id}}\n    <br><br>\n    <br><br>\n    <button type=\"submit\" onclick=\"submitMessage()\">Geräte tauschen</button>\n</form>\n<br><br>\n<a href=\"https://hom.ee\"><strong>homee Website</strong></a>\n<br><br>\n<a href=\"https://community.hom.ee/t/geraete-ersetzen-in-hgs/35555\"><strong>homee Community Thread</strong></a>\n<br><br>\n<textarea name=\"message\" style=\"color:red;font-size:120%;\" rows=\"10\" cols=\"60\">{{payload.change}}</textarea>\n<br><br>\n<iframe width="420" height="345" src="https://www.youtube.com/embed/HamaS_jBWw4">
</iframe>\n</center>\n</body>\n</html>",
        "output": "str",
        "x": 280,
        "y": 700,
        "wires": [
            [
                "5fbf3bef.e1b35c"
            ]
        ]
    },
    {
        "id": "5fbf3bef.e1b35c",
        "type": "http response",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 470,
        "y": 700,
        "wires": []
    },
    {
        "id": "60f51ee9.2347a",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 80,
        "y": 780,
        "wires": [
            [
                "bc19d08.97e75b",
                "2e4df018.8d71f8",
                "2825c1b.61fe33e"
            ]
        ]
    },
    {
        "id": "2e4df018.8d71f8",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "get:all",
        "output": "str",
        "x": 280,
        "y": 780,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "2825c1b.61fe33e",
        "type": "change",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.old_id",
                "pt": "msg",
                "to": "old_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.new_id",
                "pt": "msg",
                "to": "new_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "res",
                "pt": "msg",
                "to": "reschange",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "req",
                "pt": "msg",
                "to": "reqchange",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 310,
        "y": 740,
        "wires": [
            []
        ]
    },
    {
        "id": "1e8d4d8a.14c3e2",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Geräte ersetzen ",
        "func": "var nodeold = parseFloat(global.get(\"old_id\")); // zu ersetzende Node ID\nvar nodenew = parseFloat(global.get(\"new_id\")); // neue Node ID \nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\nvar change = \"\";\nvar res = global.get(\"reschange\");\nvar req = global.get(\"reqchange\");\n\nif (Object.keys(msg.payload)[0] === \"homeegrams\"){\nvar hg = msg.payload.homeegrams;\nhg.forEach(function(hgs){\n    hgs.triggers.attribute_triggers.forEach(function(trigger){\n        if (trigger.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})\n        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Auslöser durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n    hgs.conditions.attribute_conditions.forEach(function(conditions){\n        if (conditions.node_id == nodeold ){\n            var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Bedingung durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    hgs.actions.attribute_actions.forEach(function(action){\n        if (action.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === action.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Aktion durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n})\n\n    node.send([null,{payload:{change:decodeURIComponent(change),old_id:nodeold,new_id:nodenew},res:res,req:req}])\n}\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 830,
        "y": 820,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ],
            [
                "2e1f57f3.63ed78"
            ]
        ]
    }
]

Tante Edit sagt:
Ich habe da nochmal was geändert, so das sowohl das automatische wechseln der Geräte als auch das manuelle enthalten ist.
Ebenso ist hier eine Testfunktion enthalten.
Die Testfunktion ist voreingestellt so das diese zwingend abgeschaltet werden muss bevor es an homee gesendet wird.


[
    {
        "id": "39fe227c.afd74e",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Geräte automatisch ersetzen ",
        "func": "var nodeold = 0;\nvar nodenew = 0;\nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\n\nvar change = \"\";\nvar res = global.get(\"reschange\");\nvar req = global.get(\"reqchange\");\n\nif (msg.payload.auto === \"start\"){\n    \n    var hg = global.get(\"homee.homeegrams\");\n    hg.forEach(function(hgs){\n     nodes.forEach(function(nodei){\n        if(nodei.protocol == msg.payload.protocol && nodei.state == msg.payload.stateold) {\n            nodeold = nodei.id\n            nodes.forEach(function(noden){\n                if(noden.name === nodei.name && noden.state == msg.payload.statenew && noden.protocol == msg.payload.protocol) {\n                        nodenew = noden.id\n                        hgs.triggers.attribute_triggers.forEach(function(trigger){\n                             if (trigger.node_id == nodeold){\n                                var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n                                        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})\n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Auslöser durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n                                })\n                            }\n                        })\n                        \n                        hgs.conditions.attribute_conditions.forEach(function(conditions){\n                             if (conditions.node_id == nodeold ){\n                                var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n                                    \n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Bedingung durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";\n                                    }\n                                })\n                            }\n                        })\n                        hgs.actions.attribute_actions.forEach(function(action){\n                            if (action.node_id == nodeold){\n                                var typeold = attribute.find(attri => attri.id === action.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Aktion durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n                                })\n                            }\n                        })\n                }\n            })\n        }\n      })\n    })\nnode.send([null,{payload:{change:decodeURIComponent(change),old_id:nodeold,new_id:nodenew},res:res,req:req}])\n\n}\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 840,
        "wires": [
            [
                "d74803af.c51c48"
            ],
            [
                "250614d.138216c",
                "cc87e620.9b7fb"
            ]
        ]
    },
    {
        "id": "76d88f4e.bfbee",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 600,
        "y": 840,
        "wires": [
            [
                "39fe227c.afd74e"
            ]
        ]
    },
    {
        "id": "ca57b1f5.c8c4b",
        "type": "homeeApi",
        "z": "92bbd3bd.5be8f",
        "homee": "",
        "name": "homeeApi",
        "messageTypeFilter": [],
        "nodeFilter": "",
        "attributeFilter": "",
        "x": 930,
        "y": 800,
        "wires": [
            [
                "1e8d4d8a.14c3e2"
            ]
        ]
    },
    {
        "id": "bc19d08.97e75b",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 600,
        "y": 800,
        "wires": [
            [
                "a9a961ca.6d0798"
            ]
        ]
    },
    {
        "id": "a9a961ca.6d0798",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "func": "msg.payload = \"get:homeegrams\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 800,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "a130206a.75975",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 130,
        "y": 760,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "2e1f57f3.63ed78",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n\n<html>\n    <script>\n    \n    function submitMessage() {\n      alert(\"Wert gespeichert\");\n      setTimeout(function(){ document.location.reload(true; }, 500);   \n    }\n  </script>\n<body>\n    <center>\n   <h1>** Geräte ID in den Homeegrammen manuell tauschen**</h1>\n<form   method = \"POST\" >\n    \n    <input type=\"number\" name=\"old_id\" placeholder=\"alte Node ID\" > {{payload.old_id}}\n    <br><br>\n    <input type=\"number\" name=\"new_id\" placeholder=\"Neue Node ID\"> {{payload.new_id}}\n    <br><br>\n    <br><br>\n    <input type=\"checkbox\" id=\"true\" name=\"yes\" value=\"1\">\n    <label for=\"true\"> Änderungen bestätigen </label><br>\n    <label for=\"test\"> Änderungen erst testen ohne an homee zu senden </label><br>\n    <select id=\"test\" name=\"test\">\n    <option value=\"1\">ja</option>\n    <option value=\"0\">nein</option>\n    </select>\n  <br><br>\n    <button type=\"submit\" onclick=\"submitMessage()\">Geräte tauschen</button>\n</form>\n<br><br>\n<a href=\"https://hom.ee\"><strong>homee Website</strong></a>\n<br><br>\n<a href=\"https://community.hom.ee/t/geraete-ersetzen-in-hgs/35555\"><strong>homee Community Thread</strong></a>\n<br><br>\n<textarea name=\"message\" style=\"color:red;font-size:120%;\" rows=\"10\" cols=\"60\">{{payload.change}}</textarea>\n<br><br>\n<h1>** Geräte ID in den Homeegrammen automatisch tauschen**</h1>\n<br><br>\n<form   method = \"POST\" >\n<label for=\"protocol\">Wähle ein Protocol aus:</label>\n  <select id=\"protocol\" name=\"protocol\">\n    <option value=\"3\">Enocean</option>\n    <option value=\"1\">Zwave</option>\n    <option value=\"2\">Zigbee</option>\n    <option value=\"21\">Exthomee (vhih)</option>\n  </select>\n  <br><br>\n<label for=\"stateold\">Wähle den Status des alten Nodes aus:</label>\n  <select id=\"stateold\" name=\"stateold\">\n    <option value=\"1\">erreichbar</option>\n    <option value=\"2\">nicht erreichbar</option>\n    <option value=\"12\">aktualisiert </option>\n    <option value=\"8\">Host nicht erreichbar</option>\n  </select> \n   <br><br>\n<label for=\"statenew\">Wähle den Status des neue Nodes aus:</label>\n  <select id=\"statenew\" name=\"statenew\">\n    <option value=\"1\">erreichbar</option>\n    <option value=\"2\">nicht erreichbar</option>\n    <option value=\"12\">aktualisiert </option>\n    <option value=\"8\">Host nicht erreichbar</option>\n  </select> \n  <br><br>\n  <input type=\"checkbox\" id=\"true\" name=\"yes\" value=\"1\">\n    <label for=\"true\"> Änderungen bestätigen </label><br>\n    <input type=\"checkbox\" id=\"auto\" name=\"auto\" value=\"start\">\n    <label for=\"auto\"> Automatisches ändern bestätigen </label><br>\n   <label for=\"test\"> Änderungen erst testen ohne an homee zu senden </label><br>\n    <select id=\"test\" name=\"test\">\n    <option value=\"1\">ja</option>\n    <option value=\"0\">nein</option>\n    </select>\n  <br><br>\n  <input type=\"submit\">\n  </form>\n<iframe width=\"420\" height=\"345\" src=\"https://www.youtube.com/embed/HamaS_jBWw4\">\n</iframe>\n</center>\n</body>\n\n</html>",
        "output": "str",
        "x": 280,
        "y": 760,
        "wires": [
            [
                "5fbf3bef.e1b35c"
            ]
        ]
    },
    {
        "id": "5fbf3bef.e1b35c",
        "type": "http response",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 410,
        "y": 760,
        "wires": []
    },
    {
        "id": "60f51ee9.2347a",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 140,
        "y": 820,
        "wires": [
            [
                "3f04560c.a83a4a",
                "2825c1b.61fe33e"
            ]
        ]
    },
    {
        "id": "2e4df018.8d71f8",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "get:all",
        "output": "str",
        "x": 580,
        "y": 760,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "2825c1b.61fe33e",
        "type": "change",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.old_id",
                "pt": "msg",
                "to": "old_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.new_id",
                "pt": "msg",
                "to": "new_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "res",
                "pt": "msg",
                "to": "reschange",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "req",
                "pt": "msg",
                "to": "reqchange",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.test",
                "pt": "msg",
                "to": "homeechangetest",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 880,
        "wires": [
            []
        ]
    },
    {
        "id": "1e8d4d8a.14c3e2",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Geräte ersetzen ",
        "func": "var nodeold = parseFloat(global.get(\"old_id\")); // zu ersetzende Node ID\nvar nodenew = parseFloat(global.get(\"new_id\")); // neue Node ID \nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\nvar change = \"\";\nvar res = global.get(\"reschange\");\nvar req = global.get(\"reqchange\");\n\nif (Object.keys(msg.payload)[0] === \"homeegrams\"){\nvar hg = msg.payload.homeegrams;\nhg.forEach(function(hgs){\n    hgs.triggers.attribute_triggers.forEach(function(trigger){\n        if (trigger.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})\n        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Auslöser durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n    hgs.conditions.attribute_conditions.forEach(function(conditions){\n        if (conditions.node_id == nodeold ){\n            var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Bedingung durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    hgs.actions.attribute_actions.forEach(function(action){\n        if (action.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === action.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Aktion durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n})\n\n    node.send([null,{payload:{change:decodeURIComponent(change),old_id:nodeold,new_id:nodenew},res:res,req:req}])\n}\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 800,
        "wires": [
            [
                "d74803af.c51c48"
            ],
            [
                "250614d.138216c"
            ]
        ]
    },
    {
        "id": "da356ed4.415a68",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.yes",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 430,
        "y": 800,
        "wires": [
            [
                "bc19d08.97e75b",
                "2e4df018.8d71f8"
            ]
        ]
    },
    {
        "id": "3f04560c.a83a4a",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.auto",
        "propertyType": "msg",
        "rules": [
            {
                "t": "else"
            },
            {
                "t": "eq",
                "v": "start",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 290,
        "y": 820,
        "wires": [
            [
                "da356ed4.415a68"
            ],
            [
                "83d6db05.d87cb"
            ]
        ]
    },
    {
        "id": "83d6db05.d87cb",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.yes",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 430,
        "y": 840,
        "wires": [
            [
                "76d88f4e.bfbee",
                "2e4df018.8d71f8"
            ]
        ]
    },
    {
        "id": "8776db1c.b9861",
        "type": "link in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "7e9a260e.a56818"
        ],
        "x": 795,
        "y": 760,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "7e9a260e.a56818",
        "type": "link out",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "8776db1c.b9861"
        ],
        "x": 1355,
        "y": 840,
        "wires": []
    },
    {
        "id": "abbf7ba8.818e1",
        "type": "link in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "250614d.138216c"
        ],
        "x": 175,
        "y": 720,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "250614d.138216c",
        "type": "link out",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "abbf7ba8.818e1"
        ],
        "x": 1275,
        "y": 840,
        "wires": []
    },
    {
        "id": "d74803af.c51c48",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "homeechangetest",
        "propertyType": "global",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1290,
        "y": 800,
        "wires": [
            [
                "cc87e620.9b7fb"
            ],
            [
                "7e9a260e.a56818"
            ]
        ]
    },
    {
        "id": "cc87e620.9b7fb",
        "type": "debug",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1220,
        "y": 740,
        "wires": []
    }
]
13 „Gefällt mir“

Ich habe den Flow nochmal erweitert.
Bei dem manuellen wechseln der Node ID werden jetzt die neuen Geräte auch den alten Gruppen des alten Gerätes zugeordnet sowie der Assistenten Rufname wird auch vom alten auf das neue Gerät übernommen.

Bekanntes Problem
Bei Double Switchen kann es zu Problemem mit den Instanzen kommen.
Wenn homee ein Double Switch anlernt werden die Instanzen nicht bei 0 hochgezählt sondern fängt mit 1 an.

Wenn also ein vhih Gerät ein zwave oder anderen Double Switch ersetzen soll ist hier bitte darauf zu achten.
Schaut euch die Bezeichnung der Schalter im homee an, wenn hier mit 1 und 2 gezählt wird, dann muss auch das vhih Geräte so gezählt werden.
Selbes ist natürlich auch bei den anderen Funkprotokollen zu beachten.
Also neue und alte Geräte kontrollieren auf die Bezeichnung, damit hier nichts schief geht.
Danke an @TiDO für die Fehlermeldung.
Ich werde probieren dieses abzufangen.

[
    {
        "id": "39fe227c.afd74e",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Geräte automatisch ersetzen ",
        "func": "var nodeold = 0;\nvar nodenew = 0;\nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\n\nvar change = \"\";\nvar res = global.get(\"reschange\");\nvar req = global.get(\"reqchange\");\n\nif (msg.payload.auto === \"start\"){\n    \n    var hg = global.get(\"homee.homeegrams\");\n    hg.forEach(function(hgs){\n     nodes.forEach(function(nodei){\n        if(nodei.protocol == msg.payload.protocol && nodei.state == msg.payload.stateold) {\n            nodeold = nodei.id\n            nodes.forEach(function(noden){\n                if(noden.name === nodei.name && noden.state == msg.payload.statenew && noden.protocol == msg.payload.protocol) {\n                        nodenew = noden.id\n                        hgs.triggers.attribute_triggers.forEach(function(trigger){\n                             if (trigger.node_id == nodeold){\n                                var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n                                        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})\n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Auslöser durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n                                })\n                            }\n                        })\n                        \n                        hgs.conditions.attribute_conditions.forEach(function(conditions){\n                             if (conditions.node_id == nodeold ){\n                                var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n                                    \n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Bedingung durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";\n                                    }\n                                })\n                            }\n                        })\n                        hgs.actions.attribute_actions.forEach(function(action){\n                            if (action.node_id == nodeold){\n                                var typeold = attribute.find(attri => attri.id === action.attribute_id );\n                                var typenew = nodes.find(node => node.id === nodenew );\n                                typenew.attributes.forEach(function(attritype){\n                                    if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n                                        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n                                        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Aktion durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n                                })\n                            }\n                        })\n                }\n            })\n        }\n      })\n    })\nnode.send([null,{payload:{change:decodeURIComponent(change),old_id:nodeold,new_id:nodenew},res:res,req:req}])\n\n}\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 840,
        "wires": [
            [
                "d74803af.c51c48"
            ],
            [
                "250614d.138216c"
            ]
        ]
    },
    {
        "id": "76d88f4e.bfbee",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 600,
        "y": 840,
        "wires": [
            [
                "39fe227c.afd74e"
            ]
        ]
    },
    {
        "id": "ca57b1f5.c8c4b",
        "type": "homeeApi",
        "z": "92bbd3bd.5be8f",
        "homee": "",
        "name": "homeeApi",
        "messageTypeFilter": [],
        "nodeFilter": "",
        "attributeFilter": "",
        "x": 930,
        "y": 800,
        "wires": [
            [
                "1e8d4d8a.14c3e2"
            ]
        ]
    },
    {
        "id": "bc19d08.97e75b",
        "type": "delay",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 600,
        "y": 800,
        "wires": [
            [
                "a9a961ca.6d0798"
            ]
        ]
    },
    {
        "id": "a9a961ca.6d0798",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "func": "msg.payload = \"get:homeegrams\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 800,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "a130206a.75975",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 130,
        "y": 760,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "2e1f57f3.63ed78",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "template": "<!DOCTYPE html>\n\n<html>\n    <script>\n    \n    function submitMessage() {\n      alert(\"Wert gespeichert\");\n      setTimeout(function(){ document.location.reload(true; }, 500);   \n    }\n  </script>\n<body>\n    <center>\n   <h1>** Geräte ID in den Homeegrammen**</h1>\n   <h1>Gruppenzugehörig und Rufnamen werden auch gesetzt</h1>\n<form   method = \"POST\" >\n    \n    <input type=\"number\" name=\"old_id\" placeholder=\"alte Node ID\" > {{payload.old_id}}\n    <br><br>\n    <input type=\"number\" name=\"new_id\" placeholder=\"Neue Node ID\"> {{payload.new_id}}\n    <br><br>\n    <br><br>\n    <input type=\"checkbox\" id=\"true\" name=\"yes\" value=\"1\">\n    <label for=\"true\"> Änderungen bestätigen </label><br>\n    <label for=\"test\"> Änderungen erst testen ohne an homee zu senden </label><br>\n    <select id=\"test\" name=\"test\">\n    <option value=\"1\">ja</option>\n    <option value=\"0\">nein</option>\n    </select>\n  <br><br>\n    <button type=\"submit\" onclick=\"submitMessage()\">Geräte tauschen</button>\n</form>\n<br><br>\n<a href=\"https://hom.ee\"><strong>homee Website</strong></a>\n<br><br>\n<a href=\"https://community.hom.ee/t/geraete-ersetzen-in-hgs/35555\"><strong>homee Community Thread</strong></a>\n<br><br>\n<textarea name=\"message\" style=\"color:red;font-size:120%;\" rows=\"10\" cols=\"60\">{{payload.change}}</textarea>\n<br><br>\n<h1>** Geräte ID in den Homeegrammen automatisch tauschen**</h1>\n<br><br>\n<form   method = \"POST\" >\n<label for=\"protocol\">Wähle ein Protocol aus:</label>\n  <select id=\"protocol\" name=\"protocol\">\n    <option value=\"3\">Enocean</option>\n    <option value=\"1\">Zwave</option>\n    <option value=\"2\">Zigbee</option>\n    <option value=\"21\">Exthomee (vhih)</option>\n  </select>\n  <br><br>\n<label for=\"stateold\">Wähle den Status des alten Nodes aus:</label>\n  <select id=\"stateold\" name=\"stateold\">\n    <option value=\"1\">erreichbar</option>\n    <option value=\"2\">nicht erreichbar</option>\n    <option value=\"12\">aktualisiert </option>\n    <option value=\"8\">Host nicht erreichbar</option>\n  </select> \n   <br><br>\n<label for=\"statenew\">Wähle den Status des neue Nodes aus:</label>\n  <select id=\"statenew\" name=\"statenew\">\n    <option value=\"1\">erreichbar</option>\n    <option value=\"2\">nicht erreichbar</option>\n    <option value=\"12\">aktualisiert </option>\n    <option value=\"8\">Host nicht erreichbar</option>\n  </select> \n  <br><br>\n  <input type=\"checkbox\" id=\"true\" name=\"yes\" value=\"1\">\n    <label for=\"true\"> Änderungen bestätigen </label><br>\n    <input type=\"checkbox\" id=\"auto\" name=\"auto\" value=\"start\">\n    <label for=\"auto\"> Automatisches ändern bestätigen </label><br>\n   <label for=\"test\"> Änderungen erst testen ohne an homee zu senden </label><br>\n    <select id=\"test\" name=\"test\">\n    <option value=\"1\">ja</option>\n    <option value=\"0\">nein</option>\n    </select>\n  <br><br>\n  <input type=\"submit\">\n  </form>\n<iframe width=\"420\" height=\"345\" src=\"https://www.youtube.com/embed/HamaS_jBWw4\">\n</iframe>\n<br><br>\n\n</center>\n</body>\n\n</html>",
        "output": "str",
        "x": 280,
        "y": 760,
        "wires": [
            [
                "5fbf3bef.e1b35c"
            ]
        ]
    },
    {
        "id": "5fbf3bef.e1b35c",
        "type": "http response",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 410,
        "y": 760,
        "wires": []
    },
    {
        "id": "60f51ee9.2347a",
        "type": "http in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "url": "/change",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 140,
        "y": 820,
        "wires": [
            [
                "3f04560c.a83a4a",
                "2825c1b.61fe33e"
            ]
        ]
    },
    {
        "id": "2e4df018.8d71f8",
        "type": "template",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "get:all",
        "output": "str",
        "x": 580,
        "y": 760,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "2825c1b.61fe33e",
        "type": "change",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload.old_id",
                "pt": "msg",
                "to": "old_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.new_id",
                "pt": "msg",
                "to": "new_id",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "res",
                "pt": "msg",
                "to": "reschange",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "req",
                "pt": "msg",
                "to": "reqchange",
                "tot": "global"
            },
            {
                "t": "move",
                "p": "payload.test",
                "pt": "msg",
                "to": "homeechangetest",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 880,
        "wires": [
            []
        ]
    },
    {
        "id": "1e8d4d8a.14c3e2",
        "type": "function",
        "z": "92bbd3bd.5be8f",
        "name": "Geräte ersetzen ",
        "func": "var nodeold = parseFloat(global.get(\"old_id\")); // zu ersetzende Node ID\nvar nodenew = parseFloat(global.get(\"new_id\")); // neue Node ID \nvar attribute = global.get(\"homee.attributes\");\nvar nodes = global.get(\"homee.nodes\");\nconst relation = global.get(\"homee.relationships\");\nconst group = global.get(\"homee.groups\");\nvar change = \"\";\nvar res = global.get(\"reschange\");\nvar req = global.get(\"reqchange\");\n\nif (Object.keys(msg.payload)[0] === \"homeegrams\"){\n    if (nodes.find(name => name.id === nodeold).phonetic_name.length > 0){\n    node.send({payload: \"PUT:nodes/\"+nodenew+\"?phonetic_name=\"+nodes.find(name => name.id === nodeold).phonetic_name})\n    node.send({payload: \"PUT:nodes/\"+nodeold+\"?phonetic_name=\"})\n    change = change+\"Der Rufname für die Assistenten wurde auf \"+nodes.find(name => name.id === nodeold).phonetic_name+\" gesetzt\"+\"\\n\\n\";\n    }\nrelation.forEach(function(rel){\n    if (rel.node_id === nodeold){\n        node.send({\n            payload: \"POST:relationships?group_id=\"+rel.group_id+\"&node_id=\"+nodenew\n        })\n        change = change+\"Gerät wurde zur Gruppe \"+group.find(gro => gro.id === rel.group_id).name+\" hinzugefügt\"+\"\\n\\n\";\n    }\n});\nvar hg = msg.payload.homeegrams;\nhg.forEach(function(hgs){\n    hgs.triggers.attribute_triggers.forEach(function(trigger){\n        if (trigger.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === trigger.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?attribute_id=\"+attritype.id});\n        node.send({payload: \"PUT:homeegrams/\"+trigger.homeegram_id+\"/triggers/\"+trigger.id+\"?node_id=\"+nodenew})\n        change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Auslöser durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n    hgs.conditions.attribute_conditions.forEach(function(conditions){\n        if (conditions.node_id == nodeold ){\n            var typeold = attribute.find(attri => attri.id === conditions.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+conditions.homeegram_id+\"/conditions/\"+conditions.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Bedingung durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    hgs.actions.attribute_actions.forEach(function(action){\n        if (action.node_id == nodeold){\n            var typeold = attribute.find(attri => attri.id === action.attribute_id );\n            var typenew = nodes.find(node => node.id === nodenew );\n            typenew.attributes.forEach(function(attritype){\n                if (attritype.type == typeold.type && attritype.instance == typeold.instance){\n        node.send({payload: \"PUT:homeegrams/\"+action.homeegram_id+\"/actions/\"+action.id+\"?node_id=\"+nodenew+\"&attribute_id=\"+attritype.id})\n          change = change+\"Bei dem Homeegramm \"+hgs.name+\" wurde der Aktion durch das Gerät \"+typenew.name+\" ersetzt\"+\"\\n\\n\";}\n            })\n        }\n    })\n    \n})\n\n    node.send([null,{payload:{change:decodeURIComponent(change),old_id:nodeold,new_id:nodenew},res:res,req:req}])\n}\n",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 800,
        "wires": [
            [
                "d74803af.c51c48"
            ],
            [
                "250614d.138216c"
            ]
        ]
    },
    {
        "id": "da356ed4.415a68",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.yes",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 430,
        "y": 800,
        "wires": [
            [
                "bc19d08.97e75b",
                "2e4df018.8d71f8"
            ]
        ]
    },
    {
        "id": "3f04560c.a83a4a",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.auto",
        "propertyType": "msg",
        "rules": [
            {
                "t": "else"
            },
            {
                "t": "eq",
                "v": "start",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 290,
        "y": 820,
        "wires": [
            [
                "da356ed4.415a68"
            ],
            [
                "83d6db05.d87cb"
            ]
        ]
    },
    {
        "id": "83d6db05.d87cb",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "payload.yes",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 430,
        "y": 840,
        "wires": [
            [
                "76d88f4e.bfbee",
                "2e4df018.8d71f8"
            ]
        ]
    },
    {
        "id": "8776db1c.b9861",
        "type": "link in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "7e9a260e.a56818"
        ],
        "x": 795,
        "y": 760,
        "wires": [
            [
                "ca57b1f5.c8c4b"
            ]
        ]
    },
    {
        "id": "7e9a260e.a56818",
        "type": "link out",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "8776db1c.b9861"
        ],
        "x": 1355,
        "y": 840,
        "wires": []
    },
    {
        "id": "abbf7ba8.818e1",
        "type": "link in",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "250614d.138216c"
        ],
        "x": 175,
        "y": 720,
        "wires": [
            [
                "2e1f57f3.63ed78"
            ]
        ]
    },
    {
        "id": "250614d.138216c",
        "type": "link out",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "links": [
            "abbf7ba8.818e1"
        ],
        "x": 1275,
        "y": 840,
        "wires": []
    },
    {
        "id": "d74803af.c51c48",
        "type": "switch",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "property": "homeechangetest",
        "propertyType": "global",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1290,
        "y": 800,
        "wires": [
            [
                "cc87e620.9b7fb"
            ],
            [
                "7e9a260e.a56818"
            ]
        ]
    },
    {
        "id": "cc87e620.9b7fb",
        "type": "debug",
        "z": "92bbd3bd.5be8f",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1420,
        "y": 740,
        "wires": []
    }
]
13 „Gefällt mir“

Micha, das ist echt genial was du da wieder umgesetzt hast. Bin leider noch immer nicht dazu gekommen es zu testen.

VG Sven

Sei doch froh das du es nicht brauchst :see_no_evil:
Aber gut zu wissen das es sowas gibt. :nerd_face:

5 „Gefällt mir“

Hab es dieses Jahr schon sehr zu schätzen gelernt das homee Du diese Funktion umgesetzt hat. Erspart im Falle eines Geräteausfalls eine Menge Stress und wertvolle Zeit.

1 „Gefällt mir“

Wirklich klasse Funktion, die in V1 auch schon getestet habe.

Kann es sein, dass bei den HG Aktionen nur 3 oder 4 Treffer des Gerätes gefunden werden? Ich habe HGS, die den Status einer Lampe (Farbe, Helligkeit, Weißwert und Status zunächst an ein virtuelles Gerät übergibt und nach wenigen Sekunden wieder zurück. Bei den HGs war nicht alles ersetzt.

Hast du per node Id oder per automatisch ausprobiert.

Nope ID

In mehreren Testläufen bei mir wurden immer alle HG‘s gefunden.
Ich kann dir mal ne Funktion schicken mit der du die HGs einer node Id abfragst.
Dann mal schauen ob da alle aufgeführt werden.

1 „Gefällt mir“

Hallo @Micha,
nachdem das mit den Geräte ersetzen in HG´s so gut funktioniert geistert bei mir eine Frage herum. Kann man nicht auf diese Art und Weise vielleicht auch unbekannten Geräten ein Profil zuweisen?

Nein leider nicht. Das Profil wird beim anlernen des Gerätes vergeben und kann über die Api nicht verändert werden.

Muss mich korrigieren, die Profile lassen sich doch ändern bei unbekannten Profilen.

:+1:

Habe es gerade mit einen neo coolcam motionsensor getestet und der hatte das Profil 0 und jetzt hat er 4015.

4 „Gefällt mir“

Nicht schlecht :relaxed:, aber ist das für etwas zu gebrauchen?

Nur für Geräte ohne Profil, die nicht richtig erkannt wurden.

Wenn das unbekannte Gerät dann ein Geräteprofil hat, sieht man wahrscheinlich in der Voransicht des Gerätes und in Smart Widget die Messwerte und man kann normalerweise Icons vergeben. Hoffe ich :wink: