Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Service Node: When change from parent node with bridge to "linked", node is still listed under a bridge's nodes #503

Open
AarneAarebye opened this issue Oct 7, 2022 · 6 comments
Assignees
Labels
bug 🐛 There is at least high chance that it is a bug!

Comments

@AarneAarebye
Copy link

AarneAarebye commented Oct 7, 2022

NRCHKB Plugin Version

1.4.3

Node JS Version

v14.20.1

NPM Version

6.14.17

Node-RED Version

V2.2.2

Operating System

Raspberry bullseye

What happened?

A service node is been listed under a bridge's node list but it is not anymore.

How to reproduce?

  1. Create two service nodes:
  • Node 1: Parent with bridge "Home" (in my flow)
  • Node 2: Parent with bridge "Home"
  1. Deploy
  2. Change Node 2 to "Linked" and let it link to Node 1 as parent Service
  3. Deploy
  4. Node 1: Change the bridge to "UF-Bath-Room" (as in my flow)
  5. Deploy
  6. List all nodes which use "Home" bridge. You will find Node 2 still listed there ==> But it is'nt anymore!

Expected behavior:

When a service node has been switched from "Parent" with a bridge attached to "Linked", then the service node should not be listed under the former bridge...

####################
[
{
"id": "45e785df4e8a22e2",
"type": "subflow",
"name": "["ON", "OFF"] ==> On[true, false]",
"info": "",
"category": "",
"in": [
{
"x": -20,
"y": 80,
"wires": [
{
"id": "b510e2537d29095f"
}
]
}
],
"out": [
{
"x": 420,
"y": 80,
"wires": [
{
"id": "b510e2537d29095f",
"port": 0
}
]
}
],
"env": [],
"meta": {},
"color": "#DDAA99"
},
{
"id": "b510e2537d29095f",
"type": "function",
"z": "45e785df4e8a22e2",
"name": "["ON", "OFF"] ==> On[true, false]",
"func": "msg.payload = msg.payload == "ON" ? {"On": true} : {"On":false};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 80,
"wires": [
[]
]
},
{
"id": "49b5fd055a3bd723",
"type": "subflow",
"name": "On[true, false] ==> ["ON", "OFF"]",
"info": "",
"category": "",
"in": [
{
"x": -20,
"y": 80,
"wires": [
{
"id": "dc9ccc7164c86211"
}
]
}
],
"out": [
{
"x": 420,
"y": 80,
"wires": [
{
"id": "dc9ccc7164c86211",
"port": 0
}
]
}
],
"env": [],
"meta": {},
"color": "#DDAA99"
},
{
"id": "dc9ccc7164c86211",
"type": "function",
"z": "49b5fd055a3bd723",
"name": "On[true, false] ==> ["ON", "OFF"]",
"func": "if (msg.payload.hasOwnProperty("On")) {\n msg.payload = msg.payload.On == true ? "ON" : "OFF";\n} else {\n msg.payload = {};\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 80,
"wires": [
[]
]
},
{
"id": "e1e79dd1.562e7",
"type": "tab",
"label": "Upper Floor",
"disabled": false,
"info": "# Upper Floor\n## Sleeping Room - \n * Storage - Left Side\n * GF-BR-Mirror-Lighting\n"
},
{
"id": "6d30c302c2dcf259",
"type": "group",
"z": "e1e79dd1.562e7",
"name": "Bath Room - Upper Floor",
"style": {
"label": true
},
"nodes": [
"9e6ba8a.88bc258",
"5bc26d45.bd01d4",
"ba61afdb.6ee7d",
"ce6cd967.5433a8",
"d6fb63705d693ed7",
"f6a5abdfde41529a",
"537cf9f8aa0a7d2c",
"a2795f14f9dadccf",
"01f2919eb4db65fd",
"5a92ccd26b80c76b"
],
"x": 14,
"y": 173,
"w": 1812,
"h": 228
},
{
"id": "beafb7e2e31badd0",
"type": "group",
"z": "e1e79dd1.562e7",
"name": "Sleeping Room - Upper Floor",
"style": {
"label": true
},
"nodes": [
"47010611.03f2e8",
"6a14cbc5.250994",
"8555f70b.2f5e68",
"dac8b514c679f84d",
"48ea45aa9891b2f9",
"33a694a801c63311"
],
"x": 14,
"y": 19,
"w": 1852,
"h": 142
},
{
"id": "5a92ccd26b80c76b",
"type": "group",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "Cabinet",
"style": {
"label": true
},
"nodes": [
"3d0c20e6.69d42",
"73a29924.8eb3e8"
],
"x": 834,
"y": 199,
"w": 192,
"h": 142
},
{
"id": "47010611.03f2e8",
"type": "mqtt out",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"name": "Upper Floor - Sleeping Room - Left - Storage Light",
"topic": "cmnd/UF-SR-LE-ST-Light/POWER",
"qos": "",
"retain": "",
"broker": "6e913629.497e08",
"x": 1650,
"y": 60,
"wires": []
},
{
"id": "6a14cbc5.250994",
"type": "mqtt in",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"name": "Upper Floor - Sleeping Room - Left - Storage Light",
"topic": "stat/UF-SR-LE-ST-Light/POWER",
"qos": "2",
"datatype": "utf8",
"broker": "6e913629.497e08",
"inputs": 0,
"x": 230,
"y": 60,
"wires": [
[
"33a694a801c63311"
]
],
"info": "Tasmota Template"
},
{
"id": "8555f70b.2f5e68",
"type": "homekit-service",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"isParent": true,
"hostType": "0",
"bridge": "0b43ebd6b9761aea",
"accessoryId": "",
"parentService": "",
"name": "Storage Light",
"serviceName": "Lightbulb",
"topic": "",
"filter": false,
"manufacturer": "SONOFF",
"model": "Mini",
"serialNo": "Unknown",
"firmwareRev": "",
"hardwareRev": "",
"softwareRev": "",
"cameraConfigVideoProcessor": "ffmpeg",
"cameraConfigSource": "",
"cameraConfigStillImageSource": "",
"cameraConfigMaxStreams": 2,
"cameraConfigMaxWidth": 1280,
"cameraConfigMaxHeight": 720,
"cameraConfigMaxFPS": 10,
"cameraConfigMaxBitrate": 300,
"cameraConfigVideoCodec": "libx264",
"cameraConfigAudioCodec": "libfdk_aac",
"cameraConfigAudio": false,
"cameraConfigPacketSize": 1316,
"cameraConfigVerticalFlip": false,
"cameraConfigHorizontalFlip": false,
"cameraConfigMapVideo": "0:0",
"cameraConfigMapAudio": "0:1",
"cameraConfigVideoFilter": "scale=1280:720",
"cameraConfigAdditionalCommandLine": "-tune zerolatency",
"cameraConfigDebug": false,
"cameraConfigSnapshotOutput": "disabled",
"cameraConfigInterfaceName": "",
"characteristicProperties": "{}",
"waitForSetupMsg": false,
"outputs": 2,
"x": 940,
"y": 60,
"wires": [
[],
[
"48ea45aa9891b2f9"
]
]
},
{
"id": "9e6ba8a.88bc258",
"type": "mqtt out",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "Upper Floor - Bath Room - Cabinet Lighting",
"topic": "cmnd/UF-BR-Cab-Light/POWER",
"qos": "",
"retain": "",
"broker": "6e913629.497e08",
"x": 1630,
"y": 240,
"wires": []
},
{
"id": "ce6cd967.5433a8",
"type": "mqtt in",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "Upper Floor - Bath Room - Cabinet Lighting",
"topic": "stat/UF-BR-Cab-Light/POWER",
"qos": "2",
"datatype": "utf8",
"broker": "6e913629.497e08",
"inputs": 0,
"x": 210,
"y": 240,
"wires": [
[
"a2795f14f9dadccf"
]
],
"info": "Tasmota Template"
},
{
"id": "3d0c20e6.69d42",
"type": "homekit-service",
"z": "e1e79dd1.562e7",
"g": "5a92ccd26b80c76b",
"isParent": true,
"hostType": "0",
"bridge": "e79c03e0a4d4dead",
"accessoryId": "",
"parentService": "",
"name": "Cabinet",
"serviceName": "Lightbulb",
"topic": "",
"filter": false,
"manufacturer": "Unknown",
"model": "Unknown",
"serialNo": "Unknown",
"firmwareRev": "",
"hardwareRev": "",
"softwareRev": "",
"cameraConfigVideoProcessor": "ffmpeg",
"cameraConfigSource": "",
"cameraConfigStillImageSource": "",
"cameraConfigMaxStreams": 2,
"cameraConfigMaxWidth": 1280,
"cameraConfigMaxHeight": 720,
"cameraConfigMaxFPS": 10,
"cameraConfigMaxBitrate": 300,
"cameraConfigVideoCodec": "libx264",
"cameraConfigAudioCodec": "libfdk_aac",
"cameraConfigAudio": false,
"cameraConfigPacketSize": 1316,
"cameraConfigVerticalFlip": false,
"cameraConfigHorizontalFlip": false,
"cameraConfigMapVideo": "0:0",
"cameraConfigMapAudio": "0:1",
"cameraConfigVideoFilter": "scale=1280:720",
"cameraConfigAdditionalCommandLine": "-tune zerolatency",
"cameraConfigDebug": false,
"cameraConfigSnapshotOutput": "disabled",
"cameraConfigInterfaceName": "",
"characteristicProperties": "{}",
"waitForSetupMsg": false,
"outputs": 2,
"x": 920,
"y": 240,
"wires": [
[],
[
"f6a5abdfde41529a"
]
]
},
{
"id": "5bc26d45.bd01d4",
"type": "mqtt out",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "Upper Floor - Bath Room - Cabinet Door",
"topic": "cmnd/UF-BR-Cab-Door/POWER",
"qos": "",
"retain": "",
"broker": "6e913629.497e08",
"x": 1620,
"y": 300,
"wires": []
},
{
"id": "ba61afdb.6ee7d",
"type": "mqtt in",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "Upper Floor - Bath Room - Cabinet Door",
"topic": "stat/UF-BR-Cab-Door/POWER",
"qos": "2",
"datatype": "utf8",
"broker": "6e913629.497e08",
"inputs": 0,
"x": 200,
"y": 300,
"wires": [
[
"01f2919eb4db65fd"
]
],
"info": "Tasmota Template"
},
{
"id": "73a29924.8eb3e8",
"type": "homekit-service",
"z": "e1e79dd1.562e7",
"g": "5a92ccd26b80c76b",
"isParent": false,
"hostType": "0",
"bridge": "ddb3acf.8adc75",
"accessoryId": "",
"parentService": "3d0c20e6.69d42",
"name": "Cabinet Door",
"serviceName": "Lightbulb",
"topic": "",
"filter": false,
"manufacturer": "Unknown",
"model": "Unknown",
"serialNo": "Unknown",
"firmwareRev": "",
"hardwareRev": "",
"softwareRev": "",
"cameraConfigVideoProcessor": "ffmpeg",
"cameraConfigSource": "",
"cameraConfigStillImageSource": "",
"cameraConfigMaxStreams": 2,
"cameraConfigMaxWidth": 1280,
"cameraConfigMaxHeight": 720,
"cameraConfigMaxFPS": 10,
"cameraConfigMaxBitrate": 300,
"cameraConfigVideoCodec": "libx264",
"cameraConfigAudioCodec": "libfdk_aac",
"cameraConfigAudio": false,
"cameraConfigPacketSize": 1316,
"cameraConfigVerticalFlip": false,
"cameraConfigHorizontalFlip": false,
"cameraConfigMapVideo": "0:0",
"cameraConfigMapAudio": "0:1",
"cameraConfigVideoFilter": "scale=1280:720",
"cameraConfigAdditionalCommandLine": "-tune zerolatency",
"cameraConfigDebug": false,
"cameraConfigSnapshotOutput": "disabled",
"cameraConfigInterfaceName": "",
"characteristicProperties": "",
"waitForSetupMsg": false,
"outputs": 2,
"x": 930,
"y": 300,
"wires": [
[],
[
"537cf9f8aa0a7d2c"
]
],
"info": "{"ContactSensorState":0,"StatusTampered":false}"
},
{
"id": "dac8b514c679f84d",
"type": "link in",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"name": "UF-SR-Storage-Light",
"links": [
"d157799b2ed89b83"
],
"x": 1365,
"y": 120,
"wires": [
[
"47010611.03f2e8"
]
]
},
{
"id": "d6fb63705d693ed7",
"type": "link in",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "UF-BR-Cabinet",
"links": [
"d157799b2ed89b83"
],
"x": 1365,
"y": 360,
"wires": [
[
"9e6ba8a.88bc258",
"5bc26d45.bd01d4"
]
]
},
{
"id": "48ea45aa9891b2f9",
"type": "subflow:49b5fd055a3bd723",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"name": "On[true, false] ==> ["ON", "OFF"]",
"x": 1240,
"y": 60,
"wires": [
[
"47010611.03f2e8"
]
]
},
{
"id": "33a694a801c63311",
"type": "subflow:45e785df4e8a22e2",
"z": "e1e79dd1.562e7",
"g": "beafb7e2e31badd0",
"name": "["ON", "OFF"] ==> On[true, false]",
"x": 640,
"y": 60,
"wires": [
[
"8555f70b.2f5e68"
]
]
},
{
"id": "f6a5abdfde41529a",
"type": "subflow:49b5fd055a3bd723",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "",
"x": 1240,
"y": 240,
"wires": [
[
"9e6ba8a.88bc258"
]
]
},
{
"id": "537cf9f8aa0a7d2c",
"type": "subflow:49b5fd055a3bd723",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "",
"x": 1240,
"y": 300,
"wires": [
[
"5bc26d45.bd01d4"
]
]
},
{
"id": "a2795f14f9dadccf",
"type": "subflow:45e785df4e8a22e2",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "["ON", "OFF"] ==> On[true, false]",
"x": 640,
"y": 240,
"wires": [
[
"3d0c20e6.69d42"
]
]
},
{
"id": "01f2919eb4db65fd",
"type": "subflow:45e785df4e8a22e2",
"z": "e1e79dd1.562e7",
"g": "6d30c302c2dcf259",
"name": "["ON", "OFF"] ==> On[true, false]",
"x": 640,
"y": 300,
"wires": [
[
"73a29924.8eb3e8"
]
]
},
{
"id": "6e913629.497e08",
"type": "mqtt-broker",
"name": "MQTT",
"broker": "192.168.178.78",
"port": "1883",
"clientid": "node-red",
"autoConnect": true,
"usetls": false,
"protocolVersion": 4,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "0b43ebd6b9761aea",
"type": "homekit-bridge",
"bridgeName": "UF-Bed Room",
"pinCode": "274-61-563",
"port": "",
"advertiser": "bonjour-hap",
"allowInsecureRequest": false,
"manufacturer": "NRCHKB",
"model": "1.4.3",
"serialNo": "Default Serial Number",
"firmwareRev": "1.4.3",
"hardwareRev": "1.4.3",
"softwareRev": "1.4.3",
"customMdnsConfig": false,
"mdnsMulticast": true,
"mdnsInterface": "",
"mdnsPort": "",
"mdnsIp": "",
"mdnsTtl": "",
"mdnsLoopback": true,
"mdnsReuseAddr": true,
"allowMessagePassthrough": false
},
{
"id": "e79c03e0a4d4dead",
"type": "homekit-bridge",
"bridgeName": "UF-Bath-Room",
"pinCode": "598-27-892",
"port": "",
"advertiser": "bonjour-hap",
"allowInsecureRequest": false,
"manufacturer": "NRCHKB",
"model": "1.4.3",
"serialNo": "Default Serial Number",
"firmwareRev": "1.4.3",
"hardwareRev": "1.4.3",
"softwareRev": "1.4.3",
"customMdnsConfig": false,
"mdnsMulticast": true,
"mdnsInterface": "",
"mdnsPort": "",
"mdnsIp": "",
"mdnsTtl": "",
"mdnsLoopback": true,
"mdnsReuseAddr": true,
"allowMessagePassthrough": false
},
{
"id": "ddb3acf.8adc75",
"type": "homekit-bridge",
"bridgeName": "Home",
"pinCode": "413-82-734",
"port": "",
"advertiser": "bonjour-hap",
"allowInsecureRequest": false,
"manufacturer": "NRCHKB",
"model": "1.4.3",
"serialNo": "Default Serial Number",
"firmwareRev": "1.4.3",
"hardwareRev": "1.4.3",
"softwareRev": "1.4.3",
"customMdnsConfig": false,
"mdnsMulticast": true,
"mdnsInterface": "",
"mdnsPort": "",
"mdnsIp": "",
"mdnsTtl": "",
"mdnsLoopback": true,
"mdnsReuseAddr": true,
"allowMessagePassthrough": false
}
]

Additional comments?

Additional comments here, if any.

Relevant log output

No response

@AarneAarebye AarneAarebye added the bug 🐛 There is at least high chance that it is a bug! label Oct 7, 2022
@AarneAarebye AarneAarebye changed the title [Bug]: Service Node: When change from parent node with bridge to linked, bridge information is still available [Bug]: Service Node: When change from parent node with bridge to "linked", node is still listed under a bridge's nodes Oct 7, 2022
@AarneAarebye
Copy link
Author

image

@AarneAarebye
Copy link
Author

[
{
"id": "73a29924.8eb3e8",
"type": "homekit-service",
"z": "e1e79dd1.562e7",
"g": "5a92ccd26b80c76b",
"isParent": false,
"hostType": "0",
"bridge": "ddb3acf.8adc75",
"accessoryId": "",
"parentService": "3d0c20e6.69d42",
"name": "Cabinet Door",
"serviceName": "Lightbulb",
"topic": "",
"filter": false,
"manufacturer": "Unknown",
"model": "Unknown",
"serialNo": "Unknown",
"firmwareRev": "",
"hardwareRev": "",
"softwareRev": "",
"cameraConfigVideoProcessor": "ffmpeg",
"cameraConfigSource": "",
"cameraConfigStillImageSource": "",
"cameraConfigMaxStreams": 2,
"cameraConfigMaxWidth": 1280,
"cameraConfigMaxHeight": 720,
"cameraConfigMaxFPS": 10,
"cameraConfigMaxBitrate": 300,
"cameraConfigVideoCodec": "libx264",
"cameraConfigAudioCodec": "libfdk_aac",
"cameraConfigAudio": false,
"cameraConfigPacketSize": 1316,
"cameraConfigVerticalFlip": false,
"cameraConfigHorizontalFlip": false,
"cameraConfigMapVideo": "0:0",
"cameraConfigMapAudio": "0:1",
"cameraConfigVideoFilter": "scale=1280:720",
"cameraConfigAdditionalCommandLine": "-tune zerolatency",
"cameraConfigDebug": false,
"cameraConfigSnapshotOutput": "disabled",
"cameraConfigInterfaceName": "",
"characteristicProperties": "",
"waitForSetupMsg": false,
"outputs": 2,
"x": 930,
"y": 300,
"wires": [
[],
[
"537cf9f8aa0a7d2c"
]
],
"info": "{"ContactSensorState":0,"StatusTampered":false}"
},
{
"id": "ddb3acf.8adc75",
"type": "homekit-bridge",
"bridgeName": "Home",
"pinCode": "413-82-734",
"port": "",
"advertiser": "bonjour-hap",
"allowInsecureRequest": false,
"manufacturer": "NRCHKB",
"model": "1.4.3",
"serialNo": "Default Serial Number",
"firmwareRev": "1.4.3",
"hardwareRev": "1.4.3",
"softwareRev": "1.4.3",
"customMdnsConfig": false,
"mdnsMulticast": true,
"mdnsInterface": "",
"mdnsPort": "",
"mdnsIp": "",
"mdnsTtl": "",
"mdnsLoopback": true,
"mdnsReuseAddr": true,
"allowMessagePassthrough": false
}
]

@AarneAarebye
Copy link
Author

image

@GogoVega
Copy link
Contributor

It's not a bug per se, when saving the node, the value of the Bridge property is not reset to empty when changing from Parent to Child. So NR still counts it in the editor.

@Shaquu
Copy link
Member

Shaquu commented Sep 29, 2024

Hmm, maybe some additional filtering required?

@GogoVega
Copy link
Contributor

In oneditsave only register the desired property and the others are empty. e.g. isParent is true and hostType is 0 => bridge is the only one with a value.

I can make a PR if you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 There is at least high chance that it is a bug!
Projects
None yet
Development

No branches or pull requests

3 participants