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.