NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

Documentation: filter maintenance #56

Closed crxporter closed 5 years ago

crxporter commented 5 years ago

I don't want to flood the other thread.

@radokristof - air purifier and filter state work great together on the latest dev branch.

screen shot 2019-03-07 at 5 15 35 pm screen shot 2019-03-07 at 5 15 52 pm

More to come once I've "cleaned it up" a bit. Likely tomorrow.

I left "FilterMaintenance" off of the Characteristics wiki page - I didn't think we would have linked services so soon! I'll have to add that in as well from the homekit protocol document.

For now I have:

screen shot 2019-03-07 at 5 19 13 pm
[{"id":"8aa0096d.e588e8","type":"debug","z":"8ab94716.868738","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":530,"y":680,"wires":[]},{"id":"cff6bdee.1f70f8","type":"homekit-service","z":"8ab94716.868738","isParent":false,"bridge":"","parentService":"398e1722.d7d75","name":"Filter 3","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":370,"y":680,"wires":[["8aa0096d.e588e8"]]},{"id":"783fe155.d7d918","type":"inject","z":"8ab94716.868738","name":"change indicate 0","topic":"","payload":"{\"FilterChangeIndication\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":660,"wires":[["cff6bdee.1f70f8"]]},{"id":"d97179f0.11e858","type":"inject","z":"8ab94716.868738","name":"change indicate 1","topic":"","payload":"{\"FilterChangeIndication\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":700,"wires":[["cff6bdee.1f70f8"]]},{"id":"c1707758.67db4","type":"inject","z":"8ab94716.868738","name":"","topic":"","payload":"{\"FilterLifeLevel\":50}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":820,"wires":[["cff6bdee.1f70f8"]]}]
radokristof commented 5 years ago

So this is a FilterMaintenance linked to AirPurifier?

crxporter commented 5 years ago

Yes sir!

Requires the Dev branch for now and isn't final. I'll be working on it further but I'm out of time for today.

In the next day or two it'll be another example on the air purifier wiki

radokristof commented 5 years ago

Thanks for your work! I have already set up a test branch for testing these new features... I don't want to ruin my setup.

crxporter commented 5 years ago

I'll update here when I have a more final version on the wiki

crxporter commented 5 years ago

Check it out

This gets complicated really quickly!! The air purifier item does a lot on it's own - then adding the filter as a linked service... Anyway this example works and is a fully functional example as far as I know.

If you want to get really complicated you could add a battery service, StatusTamper, StatusActive...

Shaquu commented 5 years ago

@crxporter omg man. It's getting more and more complex every day! Thanks for taking care about docs!

radokristof commented 5 years ago

I havent updated my real setup to the dev branch. Should I or when you want to merge these into master? I have a different setup for testing...

Shaquu commented 5 years ago

@radokristof I always try to be sure that dev is backward compatible (in most cases) but sometimes something bad can happen. Always backup before updating and keep to last dev to be a happy person with newest features ;)

crxporter commented 5 years ago

I’m going to close this one, if anyone has more questions about the air purifier or filter feel free to ask here anytime!

radokristof commented 5 years ago

I have tried adding AirQualitySensor and FilterMaintenance to my AirPurifier like in your example, but it won't appear inside the AirPurifier. It is still viewable as a seperate device.

crxporter commented 5 years ago

Paste your code please!

radokristof commented 5 years ago

[{"id":"da961da6.230f7","type":"homekit-service","z":"dfde00c8.7446","isParent":true,"bridge":"db6c4c1.9b703b","parentService":"","name":"Légtisztító","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Xiaomi","model":"Air Purifier Pro","serialNo":"123","characteristicProperties":"{\n \"LockPhysicalControls\": true,\n \"TargetAirPurifierState\":true\n}","x":830,"y":240,"wires":[["66990b7d.3282a4","19231361.2fd3ed","e230f903.5c50e8"]]},{"id":"1294d463.f9566c","type":"homekit-service","z":"dfde00c8.7446","bridge":"db6c4c1.9b703b","name":"Hőmérséklet","serviceName":"TemperatureSensor","manufacturer":"Xiaomi","model":"Air Purifier Pro","serialNo":"111","characteristicProperties":"{}","x":830,"y":500,"wires":[[]]},{"id":"b8ba60e1.b8dfe","type":"function","z":"dfde00c8.7446","name":"openHab to HomeKit","func":"var input = msg.payload;\nmsg.payload = {\n \"StatusActive\" : 1,\n \"CurrentTemperature\" : input\n};\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":500,"wires":[["1294d463.f9566c"]]},{"id":"5cc7fbee.756ca4","type":"homekit-service","z":"dfde00c8.7446","isParent":false,"bridge":"db6c4c1.9b703b","parentService":"e0834ce.9b7ccb","name":"Levegőminőség","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"Xiaomi","model":"Air Purifier Pro","serialNo":"111","characteristicProperties":"{}","x":820,"y":580,"wires":[[]]},{"id":"de8ac876.0fb7d8","type":"function","z":"dfde00c8.7446","name":"openHab to HomeKit","func":"var input = msg.payload;\nvar airquality;\nif(input < 10) {\n airquality = 1;\n}\nelse if(input > 10 && input < 30) {\n airquality = 2;\n}\nelse if(input > 30 && input < 50) {\n airquality = 3;\n}\nelse if(input > 50 && input < 100) {\n airquality = 4;\n}\nelse if(input > 100) {\n airquality = 5;\n}\nmsg = {\n payload : {\n \"StatusActive\" : true,\n \"AirQuality\" : airquality,\n \"PM2_5Density\" : input\n }\n};\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":580,"wires":[["5cc7fbee.756ca4"]]},{"id":"e64f32c8.1e315","type":"homekit-service","z":"dfde00c8.7446","bridge":"db6c4c1.9b703b","name":"Légnedvesség","serviceName":"HumiditySensor","manufacturer":"Xiaomi","model":"Air Purifier Pro","serialNo":"111","characteristicProperties":"{}","x":820,"y":120,"wires":[[]]},{"id":"3e9ad80d.7fe2f8","type":"function","z":"dfde00c8.7446","name":"openHab to HomeKit","func":"var input = msg.payload;\nmsg.payload = {\n \"CurrentRelativeHumidity\" : input\n};\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":120,"wires":[["e64f32c8.1e315"]]},{"id":"66990b7d.3282a4","type":"function","z":"dfde00c8.7446","name":"Turn ON/OFF","func":"if(msg.hap.context !== undefined) {\n if(msg.payload.hasOwnProperty(\"Active\")) {\n if(msg.payload.Active === 1) {\n msg.payload = \"ON\";\n }\n else {\n msg.payload = \"OFF\";\n }\n return msg;\n }\n}","outputs":1,"noerr":0,"x":1160,"y":380,"wires":[["f0672ad1.c5a2a8","fb95dea7.30f95","7d49c886.48d048"]]},{"id":"cf9e372f.6bf248","type":"function","z":"dfde00c8.7446","name":"openHab to HomeKit","func":"if(msg.payload == \"auto\") {\n msg.payload = {\n \"TargetAirPurifierState\" : 1\n };\n}\nelse if(msg.payload == \"silent\") {\n msg.payload = {\n \"TargetAirPurifierState\" : 1\n };\n}\nelse if(msg.payload == \"favorite\") {\n msg.payload = {\n \"TargetAirPurifierState\" : 0\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":240,"wires":[["da961da6.230f7"]]},{"id":"19231361.2fd3ed","type":"function","z":"dfde00c8.7446","name":"Set Auto/Manual mode","func":"if(msg.hap.context !== undefined) {\n if(msg.payload.hasOwnProperty(\"TargetAirPurifierState\"))\n {\n if(msg.payload.TargetAirPurifierState === 0) {\n msg.payload = \"favorite\";\n }\n else {\n msg.payload = \"auto\";\n }\n return msg; \n }\n}","outputs":1,"noerr":0,"x":1040,"y":280,"wires":[["7d7b8ade.db24a4"]]},{"id":"7a8c9b58.e91bf4","type":"function","z":"dfde00c8.7446","name":"openHab to HomeKit","func":"if(msg.payload == \"ON\") {\n msg.payload = {\n \"LockPhysicalControls\" : true\n };\n}\nelse {\n msg.payload = {\n \"LockPhysicalControls\" : false\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":180,"wires":[["da961da6.230f7"]]},{"id":"e230f903.5c50e8","type":"function","z":"dfde00c8.7446","name":"Set Child Lock","func":"if(msg.hap.context !== undefined) {\n if(msg.payload.hasOwnProperty(\"LockPhysicalControls\")) {\n if(msg.payload.LockPhysicalControls == 1) {\n msg.payload = \"ON\";\n }\n else {\n msg.payload = \"OFF\";\n }\n return msg;\n }\n}","outputs":1,"noerr":0,"x":1020,"y":200,"wires":[["cc522482.d13208"]]},{"id":"f0672ad1.c5a2a8","type":"openhab-v2-out","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirPower","topic":"ItemCommand","topicType":"oh_cmd","payload":"payload","payloadType":"msg","storeStateInFlow":false,"x":1410,"y":380,"wires":[]},{"id":"7d7b8ade.db24a4","type":"openhab-v2-out","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirMode","topic":"ItemCommand","topicType":"oh_cmd","payload":"payload","payloadType":"msg","storeStateInFlow":false,"x":1410,"y":280,"wires":[]},{"id":"cc522482.d13208","type":"openhab-v2-out","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirChildLock","topic":"ItemCommand","topicType":"oh_cmd","payload":"payload","payloadType":"msg","storeStateInFlow":false,"x":1400,"y":180,"wires":[]},{"id":"e2725ea6.d4de5","type":"function","z":"dfde00c8.7446","name":"Turn on Target State","func":"if(msg.payload == \"ON\") {\n msg.payload = {\n \"Active\": 1\n };\n}\nelse if(msg.payload == \"OFF\") {\n msg.payload = {\n \"Active\": 0\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":320,"wires":[["da961da6.230f7","f2f24fb9.b1531"]]},{"id":"f2f24fb9.b1531","type":"delay","z":"dfde00c8.7446","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":600,"y":320,"wires":[["5af18295.88465c"]]},{"id":"5af18295.88465c","type":"function","z":"dfde00c8.7446","name":"Set Current State to ON","func":"if(msg.payload.Active == 1) {\n msg.payload = {\n \"CurrentAirPurifierState\": 2\n };\n}\nelse {\n msg.payload = {\n \"CurrentAirPurifierState\": 0\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":380,"wires":[["da961da6.230f7"]]},{"id":"fb95dea7.30f95","type":"delay","z":"dfde00c8.7446","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1240,"y":480,"wires":[["c43f04ca.f1d1d8"]]},{"id":"c43f04ca.f1d1d8","type":"function","z":"dfde00c8.7446","name":"Set Current State","func":"if(msg.payload == \"ON\") {\n msg.payload = {\n \"CurrentAirPurifierState\": 2\n };\n}\nelse {\n msg.payload = {\n \"CurrentAirPurifierState\": 0\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":1430,"y":480,"wires":[["da961da6.230f7"]]},{"id":"7d49c886.48d048","type":"function","z":"dfde00c8.7446","name":"Set Active state","func":"if(msg.payload == \"ON\") {\n msg.payload = {\n \"Active\": 1\n };\n}\nelse {\n msg.payload = {\n \"Active\": 0\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":900,"y":380,"wires":[["da961da6.230f7"]]},{"id":"950bd659.658188","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirHumidity","ohCompatibleTimestamp":false,"eventTypes":["ItemStateChangedEvent"],"outputAtStartup":true,"storeStateInFlow":false,"x":170,"y":120,"wires":[["3e9ad80d.7fe2f8"],[]]},{"id":"17d92e00.1eb512","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirChildLock","ohCompatibleTimestamp":false,"eventTypes":["ItemStateChangedEvent"],"outputAtStartup":true,"storeStateInFlow":false,"x":180,"y":180,"wires":[["7a8c9b58.e91bf4"],[]]},{"id":"9e816c39.092c7","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirMode","ohCompatibleTimestamp":false,"eventTypes":[""],"outputAtStartup":true,"storeStateInFlow":false,"x":160,"y":240,"wires":[["cf9e372f.6bf248"],[]]},{"id":"806eea12.ed6fc8","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirPower","ohCompatibleTimestamp":false,"eventTypes":["ItemStateChangedEvent"],"outputAtStartup":true,"storeStateInFlow":false,"x":170,"y":320,"wires":[["e2725ea6.d4de5"],[]]},{"id":"752272d8.26d4dc","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirTemperature","ohCompatibleTimestamp":false,"eventTypes":["ItemStateChangedEvent"],"outputAtStartup":true,"storeStateInFlow":false,"x":180,"y":500,"wires":[["b8ba60e1.b8dfe"],[]]},{"id":"44cba763.c9be88","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirQuality","ohCompatibleTimestamp":false,"eventTypes":["ItemStateChangedEvent"],"outputAtStartup":true,"storeStateInFlow":false,"x":170,"y":580,"wires":[["de8ac876.0fb7d8"],[]]},{"id":"9cf9d35a.83424","type":"homekit-service","z":"dfde00c8.7446","isParent":false,"bridge":"","parentService":"da961da6.230f7","name":"Légtisztító szűrő","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"Xiaomi","model":"Air Purifier Pro","serialNo":"111","characteristicProperties":"{\n \"FilterChangeIndication\":true,\n \"FilterLifeLevel\":true\n}","x":820,"y":660,"wires":[[]]},{"id":"86d678be.41eaf8","type":"function","z":"dfde00c8.7446","name":"Translate to openHAB","func":"var input = msg.payload;\n\nif(input < 20) {\n msg.payload = {\n \"FilterChangeIndication\": 1,\n \"FilterLifeLevel\": input\n };\n}\nelse {\n msg.payload = {\n \"FilterChangeIndication\": 0,\n \"FilterLifeLevel\": input\n };\n}\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":660,"wires":[["9cf9d35a.83424"]]},{"id":"902fe314.705ba","type":"openhab-v2-in","z":"dfde00c8.7446","name":"","controller":"427d851b.f7e23c","item":"miAirFilterLife","ohCompatibleTimestamp":false,"eventTypes":[""],"outputAtStartup":true,"storeStateInFlow":false,"x":170,"y":660,"wires":[["86d678be.41eaf8"],[]]},{"id":"db6c4c1.9b703b","type":"homekit-bridge","z":"","bridgeName":"openHAB - RED","pinCode":"111-22-333","port":"","manufacturer":"Node-RED","model":"v2.0","serialNo":"Default Serial Number"},{"id":"427d851b.f7e23c","type":"openhab-v2-controller","z":"","name":"openhab2","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":"","allowRawEvents":true}]

radokristof commented 5 years ago

These are the Services in one flow. Not all of them are used in one item. If you copy paste it you will see... I don't know what can cause an issue like this. I have also tried deleting and re-inserting these nodes, this didn't help either.

crxporter commented 5 years ago

I just pasted that all in and clicked on "Levegőminőség" (air purifier) and "Légtisztító szűrő" (air filter) which appear to be marked as "linked services"

I suppose you may also be using "Légtisztító" (air purifier) up above - it has more things connected to it.

Anyway, it appears you don't have any parent services picked out for your linked services.

If you want to link "Légtisztító szűrő" as the filter item for "Légtisztító" then you'll need to choose "Légtisztító" as the parent service for "Légtisztító szűrő" - like this:

Screen Shot 2019-03-15 at 5 56 33 PM

I'm assuming you know what all of those words mean easier than me! I just copy/pasted and checked google translate...

crxporter commented 5 years ago

Oh and (as always) don't forget to restart node-red after deploy!

radokristof commented 5 years ago

This is what happened when I deleted and pasted my code back... But apparently this is what I have in air filter (so it is linked to the Air Purifier): Screenshot (103)

crxporter commented 5 years ago

Interesting - I'm going to go back to examples and actually run it all again. I just looked at your nodes a few minutes ago - I didn't run it.

Stand by.

radokristof commented 5 years ago

Thanks!

radokristof commented 5 years ago

Some thing I can think of:

Now I will try to add a BatteryLevel or something to another Service...

crxporter commented 5 years ago

Just pasted in from the example wiki. I had to set the parent node as in my last comment again - it didn't come in from the paste. The wiki example is from the dev branch though so that may not be an issue.

I'm going to make a new bridge, add in a purifier and filter, name them as yours, and see what happens.

Be right back.

radokristof commented 5 years ago

Thanks. Do Linked Services should appear as a seperate device in HomeKit as well? Because this is what I have now. Set as Linked but showing properly as a seperate (Parent) device (both of them).

crxporter commented 5 years ago

They appear together - as one device. Like this: IMG_2D6E2A7BB3EF-1

Flow for this is:

[{"id":"14d77c7d.0306dc","type":"debug","z":"3ffabeea.be7dea","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":750,"y":620,"wires":[]},{"id":"99befffd.25676","type":"inject","z":"3ffabeea.be7dea","name":"Filter status \"good\"","topic":"","payload":"{\"FilterChangeIndication\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":600,"wires":[["3e55b5a1.0cf33a"]]},{"id":"efb6377c.cd6be","type":"inject","z":"3ffabeea.be7dea","name":"Filter 50%","topic":"","payload":"{\"FilterLifeLevel\":50}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":760,"wires":[["3e55b5a1.0cf33a"]]},{"id":"5636d2a5.b38cf4","type":"inject","z":"3ffabeea.be7dea","name":"Filter status \"change soon\"","topic":"","payload":"{\"FilterChangeIndication\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":640,"wires":[["3e55b5a1.0cf33a"]]},{"id":"e591deaf.4c01d8","type":"inject","z":"3ffabeea.be7dea","name":"Filter 25%","topic":"","payload":"{\"FilterLifeLevel\":25}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":800,"wires":[["3e55b5a1.0cf33a"]]},{"id":"1f6c55e1.044aba","type":"inject","z":"3ffabeea.be7dea","name":"Filter 100%","topic":"","payload":"{\"FilterLifeLevel\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":720,"wires":[["3e55b5a1.0cf33a"]]},{"id":"1a812f14.ab3dd1","type":"inject","z":"3ffabeea.be7dea","name":"Manual Mode","topic":"","payload":"{\"TargetAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":200,"wires":[["f80eb650.1a5de8"]]},{"id":"e1173778.a4f8e","type":"inject","z":"3ffabeea.be7dea","name":"Target state: on","topic":"","payload":"{\"Active\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":160,"wires":[["f80eb650.1a5de8"]]},{"id":"9a0b9eca.dd0718","type":"inject","z":"3ffabeea.be7dea","name":"Target state: off","topic":"","payload":"{\"Active\":false}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":200,"wires":[["f80eb650.1a5de8"]]},{"id":"f49a1320.472e28","type":"inject","z":"3ffabeea.be7dea","name":"Auto mode","topic":"","payload":"{\"TargetAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":160,"wires":[["f80eb650.1a5de8"]]},{"id":"9847b7ac.7df648","type":"inject","z":"3ffabeea.be7dea","name":"Current State: ON","topic":"","payload":"{\"CurrentAirPurifierState\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":360,"wires":[["f80eb650.1a5de8"]]},{"id":"ad57c822.1b3f58","type":"inject","z":"3ffabeea.be7dea","name":"Current State: OFF","topic":"","payload":"{\"CurrentAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["f80eb650.1a5de8"]]},{"id":"7db9b7bf.771af","type":"inject","z":"3ffabeea.be7dea","name":"Current State: IDLE","topic":"","payload":"{\"CurrentAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":320,"wires":[["f80eb650.1a5de8"]]},{"id":"85c4fd0c.9b41b","type":"debug","z":"3ffabeea.be7dea","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":830,"y":320,"wires":[]},{"id":"d944c665.a54fc8","type":"inject","z":"3ffabeea.be7dea","name":"Child lock on","topic":"","payload":"{\"LockPhysicalControls\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":420,"wires":[["f80eb650.1a5de8"]]},{"id":"9fcf7de8.7c174","type":"inject","z":"3ffabeea.be7dea","name":"Child lock off","topic":"","payload":"{\"LockPhysicalControls\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":460,"wires":[["f80eb650.1a5de8"]]},{"id":"12082d36.8bb953","type":"inject","z":"3ffabeea.be7dea","name":"Oscillate on","topic":"","payload":"{\"SwingMode\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":440,"wires":[["f80eb650.1a5de8"]]},{"id":"a0f63c59.96953","type":"inject","z":"3ffabeea.be7dea","name":"Oscillate off","topic":"","payload":"{\"SwingMode\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":480,"wires":[["f80eb650.1a5de8"]]},{"id":"f80eb650.1a5de8","type":"homekit-service","z":"3ffabeea.be7dea","isParent":true,"bridge":"ceedb2f1.be6e78","parentService":"","name":"Légtisztító","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{\n    \"TargetAirPurifierState\":true,\n    \"SwingMode\":true,\n    \"LockPhysicalControls\":true\n}","x":630,"y":320,"wires":[["85c4fd0c.9b41b"]]},{"id":"3e55b5a1.0cf33a","type":"homekit-service","z":"3ffabeea.be7dea","isParent":false,"bridge":"","parentService":"f80eb650.1a5de8","name":"Légtisztító szűrő","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{\n    \"FilterLifeLevel\":true,\n    \"FilterChangeIndication\":true\n}","x":580,"y":640,"wires":[["14d77c7d.0306dc"]]},{"id":"ceedb2f1.be6e78","type":"homekit-bridge","z":"","bridgeName":"Kristof 3","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true}]

I just recreated both homekit nodes under a new bridge. Hit deploy and that screenshot is what you should see in the Home app...

crxporter commented 5 years ago

@Shaquu - it looks like linked nodes don't correctly populate the parent node when pasted in.

Try it for yourself:

[{"id":"14d77c7d.0306dc","type":"debug","z":"3ffabeea.be7dea","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":750,"y":620,"wires":[]},{"id":"99befffd.25676","type":"inject","z":"3ffabeea.be7dea","name":"Filter status \"good\"","topic":"","payload":"{\"FilterChangeIndication\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":600,"wires":[["3e55b5a1.0cf33a"]]},{"id":"efb6377c.cd6be","type":"inject","z":"3ffabeea.be7dea","name":"Filter 50%","topic":"","payload":"{\"FilterLifeLevel\":50}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":760,"wires":[["3e55b5a1.0cf33a"]]},{"id":"5636d2a5.b38cf4","type":"inject","z":"3ffabeea.be7dea","name":"Filter status \"change soon\"","topic":"","payload":"{\"FilterChangeIndication\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":640,"wires":[["3e55b5a1.0cf33a"]]},{"id":"e591deaf.4c01d8","type":"inject","z":"3ffabeea.be7dea","name":"Filter 25%","topic":"","payload":"{\"FilterLifeLevel\":25}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":800,"wires":[["3e55b5a1.0cf33a"]]},{"id":"1f6c55e1.044aba","type":"inject","z":"3ffabeea.be7dea","name":"Filter 100%","topic":"","payload":"{\"FilterLifeLevel\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":720,"wires":[["3e55b5a1.0cf33a"]]},{"id":"1a812f14.ab3dd1","type":"inject","z":"3ffabeea.be7dea","name":"Manual Mode","topic":"","payload":"{\"TargetAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":200,"wires":[["f80eb650.1a5de8"]]},{"id":"e1173778.a4f8e","type":"inject","z":"3ffabeea.be7dea","name":"Target state: on","topic":"","payload":"{\"Active\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":160,"wires":[["f80eb650.1a5de8"]]},{"id":"9a0b9eca.dd0718","type":"inject","z":"3ffabeea.be7dea","name":"Target state: off","topic":"","payload":"{\"Active\":false}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":200,"wires":[["f80eb650.1a5de8"]]},{"id":"f49a1320.472e28","type":"inject","z":"3ffabeea.be7dea","name":"Auto mode","topic":"","payload":"{\"TargetAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":160,"wires":[["f80eb650.1a5de8"]]},{"id":"9847b7ac.7df648","type":"inject","z":"3ffabeea.be7dea","name":"Current State: ON","topic":"","payload":"{\"CurrentAirPurifierState\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":360,"wires":[["f80eb650.1a5de8"]]},{"id":"ad57c822.1b3f58","type":"inject","z":"3ffabeea.be7dea","name":"Current State: OFF","topic":"","payload":"{\"CurrentAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["f80eb650.1a5de8"]]},{"id":"7db9b7bf.771af","type":"inject","z":"3ffabeea.be7dea","name":"Current State: IDLE","topic":"","payload":"{\"CurrentAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":320,"wires":[["f80eb650.1a5de8"]]},{"id":"85c4fd0c.9b41b","type":"debug","z":"3ffabeea.be7dea","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":830,"y":320,"wires":[]},{"id":"d944c665.a54fc8","type":"inject","z":"3ffabeea.be7dea","name":"Child lock on","topic":"","payload":"{\"LockPhysicalControls\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":420,"wires":[["f80eb650.1a5de8"]]},{"id":"9fcf7de8.7c174","type":"inject","z":"3ffabeea.be7dea","name":"Child lock off","topic":"","payload":"{\"LockPhysicalControls\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":460,"wires":[["f80eb650.1a5de8"]]},{"id":"12082d36.8bb953","type":"inject","z":"3ffabeea.be7dea","name":"Oscillate on","topic":"","payload":"{\"SwingMode\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":440,"wires":[["f80eb650.1a5de8"]]},{"id":"a0f63c59.96953","type":"inject","z":"3ffabeea.be7dea","name":"Oscillate off","topic":"","payload":"{\"SwingMode\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":480,"wires":[["f80eb650.1a5de8"]]},{"id":"f80eb650.1a5de8","type":"homekit-service","z":"3ffabeea.be7dea","isParent":true,"bridge":"ceedb2f1.be6e78","parentService":"","name":"Légtisztító","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{\n    \"TargetAirPurifierState\":true,\n    \"SwingMode\":true,\n    \"LockPhysicalControls\":true\n}","x":630,"y":320,"wires":[["85c4fd0c.9b41b"]]},{"id":"3e55b5a1.0cf33a","type":"homekit-service","z":"3ffabeea.be7dea","isParent":false,"bridge":"","parentService":"f80eb650.1a5de8","name":"Légtisztító szűrő","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{\n    \"FilterLifeLevel\":true,\n    \"FilterChangeIndication\":true\n}","x":580,"y":640,"wires":[["14d77c7d.0306dc"]]},{"id":"ceedb2f1.be6e78","type":"homekit-bridge","z":"","bridgeName":"Kristof 3","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true}]

Is this a bug just for me or are you seeing it as well?

crxporter commented 5 years ago

It works fine for me. Follow these steps:

1- add a new homekit node with a new bridge 2- set it up as "air purifier" (hungarian name is fine, see screenshot 1) 3- add another homekit node as "filter maintenance" (screenshot 2) 4- deploy and add the new bridge to home app

You should end up with an air purifier and a filter status - like in my screenshot a few minutes ago.

Screenshot 1

Screen Shot 2019-03-15 at 6 22 27 PM

Screenshot 2

Screen Shot 2019-03-15 at 6 23 45 PM
radokristof commented 5 years ago

Yes, I have created a new bridge, now it works (however I don't know why filter life is not appering, it is just blank, but I will check that). But I want to add AirQualitySensor also. But that still doesn't seen as a linked service, just as a seperate device...

crxporter commented 5 years ago

I have not tried AirQualitySensor - it likely will be another device. You can set it up as linked and it will be moved to the same room in homekit as whatever you link it to.

The linked services are interesting, all of the combinations may not actually make sense - for example you COULD link a door sensor with a sprinkler. But you probably shouldn't.

radokristof commented 5 years ago

Hmm, that makes sense (or not? :) ). A problem with the Filter Life not viewing can be that I'm sending the state together in on object with the FilterCondition? I will try to delay one of them... Edit: Solved. It seems that I have to send it as an integer, it won't convert strings to int. That makes sense in other cases as well (for example: RGBW represtation) Stay tuned...

Shaquu commented 5 years ago

@crxporter You called me. So, there is a bug with importing flows that make it ? Is flow containing Parent and Linked or only one of them? If so then this is clear for me as there are unique id's for nodes. If both are in the flow then I have to look at this... I will investigate anyway.

crxporter commented 5 years ago

Use the flow I pasted in the comment where I flagged you.

When I exported that it included a parent and a linked - properly configured and ready to use.

I believe when you import it you will see no parent selected on the filter maintenance linked node.

crxporter commented 5 years ago

@radokristof - did you get this working?

@Shaquu

flow containing Parent and Linked or only one of them?

The pasted flow should have both the parent and linked service included but never actually "wired together" anywhere so technically 2 flows.

The important question would be: is there a way we can paste flows containing properly configured parent and linked services? It appears right now that pasted flows for linked services will always need to choose again the parent node. If this is as designed and can't be fixed then the documentation will need to have notes for linked services.

radokristof commented 5 years ago

@crxporter Yes, it is working! Think we can close it.

Shaquu commented 5 years ago

I am pretty sure we can make it work when copying flow but didn't figure it out yet... I can add validation for now.

crxporter commented 5 years ago

@Shaquu I'll close this one and let you start a new issue for the copying issue if you like. Thanks!