Homekit

8 comments started 2023-10-24 last 2023-10-31
Home AutomationNodeRed
D
#1 DreadorUK

I didn't have a big need - just wanted to see battery charge level on my phone to see how much power was left to try and prevent any creep into standard price leecy as I just have AIO no solar or anything.

I don't use Home Assistant, and didn't want node-red to home assistant - homekit

Using just the node-red-contrib-wiw-bridge on docker I was able (and Im no expert) to get the Cloud API pull into node red and push it out as a lightbulb to homekit and solve my need

Pretty happy with results though

D
#2 Daveb01

DreadorUK

I am very impressed, you should work for GE.

I would like to know in a week plus week 2 how accurate the % is.
Can you update this post please 🤞👍

D
#3 DreadorUK

Okay been playing a little more tonight and added three temp sensors (don't blame me blame homekit)

One temp sensor is really Grid KWH, one is Battery KWH, Final one is 13500/(BatteryPecent/100)/Battery W which will show as how many hours would be left at current battery draw.

You will have to relabel the temp sensors your self in homekit as it wont take name given in Node Red and also remember if you don't want them to show in your house temp summary to take them out of said summary

WIth these four feeds I should be able to make up most of the automations Id need in homekit itself

Node Red JSON main edit point is http request where you need to add you API key and your inverter/battery - finally if you want to tweak the hours left calculation to match your capacity its the change node next to HR + you will need to have a working homekit module installed.

[{"id":"4d94aea60def9c3c","type":"http request","z":"d92a466e1054ea34","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.givenergy.cloud/v1/inverter/[EnterBatteryID]/system-data/latest?=","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"Accept","valueType":"other","valueValue":"application/json"}],"x":370,"y":380,"wires":[["5404cc58794aa27f","94bf0ea18c3afc13","ba2ed301898d9161","57844760cbfa5096"]]},{"id":"2895119a688f6467","type":"inject","z":"d92a466e1054ea34","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":380,"wires":[["4d94aea60def9c3c"]]},{"id":"5404cc58794aa27f","type":"change","z":"d92a466e1054ea34","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Brightness\" : payload.data.battery.percent}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":380,"wires":[["0a89cabc1e5dad32"]]},{"id":"0a89cabc1e5dad32","type":"homekit-service","z":"d92a466e1054ea34","isParent":true,"hostType":"0","bridge":"beee3373e39c2f79","accessoryId":"","parentService":"","name":"Battery","serviceName":"Lightbulb","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","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":820,"y":380,"wires":[[],[]]},{"id":"b443c87b97b92a5d","type":"inject","z":"d92a466e1054ea34","name":"Turned On","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"On\" : 1}","payloadType":"jsonata","x":570,"y":260,"wires":[["0a89cabc1e5dad32"]]},{"id":"94bf0ea18c3afc13","type":"change","z":"d92a466e1054ea34","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"CurrentTemperature\" : payload.data.grid.power/1000}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":480,"wires":[["18d019352042dfac"]]},{"id":"aeeefc3be8b04d9c","type":"homekit-service","z":"d92a466e1054ea34","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"0a89cabc1e5dad32","name":"BKWH","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","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":810,"y":580,"wires":[[],[]]},{"id":"ba2ed301898d9161","type":"change","z":"d92a466e1054ea34","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"CurrentTemperature\" : payload.data.battery.power/1000}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":580,"wires":[["aeeefc3be8b04d9c"]]},{"id":"18d019352042dfac","type":"homekit-service","z":"d92a466e1054ea34","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"0a89cabc1e5dad32","name":"GKWH","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","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":810,"y":480,"wires":[[],[]]},{"id":"57844760cbfa5096","type":"change","z":"d92a466e1054ea34","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"CurrentTemperature\" : 13500*(payload.data.battery.percent/100)/payload.data.battery.power}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":680,"wires":[["8f7354c03c972ef8"]]},{"id":"8f7354c03c972ef8","type":"homekit-service","z":"d92a466e1054ea34","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"0a89cabc1e5dad32","name":"HR","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","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":810,"y":680,"wires":[[],[]]},{"id":"beee3373e39c2f79","type":"homekit-bridge","bridgeName":"Giv","pinCode":"908-30-809","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

N
#5 Northwarks

I've duly copied this to play with, great work!

D
#6 DreadorUK

Daveb01

Hi Dave

As requested - So its been working fine for a week, had one issue with NAS crashing (red node installed on it) and apart from that the only other issue is standby mode going into Lock Screen mode, but that's known issue with standby mode.

Added % remaining at current draw is working well, just remembering to ignore it when charging.

Re accuracy it's pulling data from GE cloud every 5 mins so for me there isn't any discrepancy as such.

J
#7 Jellybaby

DreadorUK Are you able to do something that takes from either flat/full charge then add/subtract daily usage, that will be far more accurate than just the systems %age readout.

Id keep an eye on that manually for a few weeks to see if it indicates any issues.

D
#8 DreadorUK

In a word no as it would require too much data retention I think to make it work and then there is the whole over time your leaking charge to inverter thing.

With the current drop issue I think what is happening is that its more the charge is thinking its 100% and then stopping then realising in use its not got the juice and drops.

With that in mind if you change charge time to 00:00 the following would then take yesterdays remaining and covert that to KwH and then add on the amount the meter charged at to see if combined they give a KwH full battery (assuming charged amount is not in doubt) which in my simple mind equals a checkpoint - I didn't roll this one into homekit but its easy enough to do using the other as an example

Note the value will not be correct until next day as such

[{"id":"143066a67e23882e","type":"tab","label":"Flow 1","disabled":true,"info":"","env":[]},{"id":"4b21696b6b5686ba","type":"http request","z":"143066a67e23882e","name":"","method":"GET","ret":"obj","paytoqs":"body","url":"https://api.givenergy.cloud/v1/inverter/[Your Inverter]/system-data/latest?=","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"Accept","valueType":"other","valueValue":"application/json"}],"x":470,"y":300,"wires":[["5a9708a8003196ba"]],"info":"--data \"{\n \\\"start_time\\\": \\\"2022-01-01\\\",\n \\\"end_time\\\": \\\"2022-01-01\\\",\n \\\"grouping\\\": 0,\n \\\"types\\\": [\n 0,\n 1,\n 2,\n 5\n ]\n}\" "},{"id":"281c7eaf504ef115","type":"http request","z":"143066a67e23882e","name":"","method":"GET","ret":"obj","paytoqs":"body","url":"https://api.givenergy.cloud/v1/inverter/[yourinverter]/meter-data/latest","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"Accept","valueType":"other","valueValue":"application/json"}],"x":470,"y":220,"wires":[["a8017064740dbccb"]],"info":"--data \"{\n \\\"start_time\\\": \\\"2022-01-01\\\",\n \\\"end_time\\\": \\\"2022-01-01\\\",\n \\\"grouping\\\": 0,\n \\\"types\\\": [\n 0,\n 1,\n 2,\n 5\n ]\n}\" "},{"id":"96a2ab35175266cf","type":"inject","z":"143066a67e23882e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":220,"wires":[["281c7eaf504ef115"]]},{"id":"a27f640b10dff0bb","type":"inject","z":"143066a67e23882e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":300,"wires":[["4b21696b6b5686ba"]]},{"id":"a8017064740dbccb","type":"change","z":"143066a67e23882e","name":"Charged Overnight","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Charge\" : payload.data.today.battery.charge}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":220,"wires":[["f7fafd4ed7d9e56a"]]},{"id":"5a9708a8003196ba","type":"change","z":"143066a67e23882e","name":"Remaining Last Night","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Remaining\": 13.5 / 100 * payload.data.battery.percent}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":300,"wires":[["f7fafd4ed7d9e56a"]]},{"id":"9c5631a3a07375d0","type":"debug","z":"143066a67e23882e","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1340,"y":220,"wires":[]},{"id":"f7fafd4ed7d9e56a","type":"join","z":"143066a67e23882e","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":990,"y":220,"wires":[["1d7ea4820d268315"]]},{"id":"1d7ea4820d268315","type":"change","z":"143066a67e23882e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Capacity\" : payload.Charge +payload.Remaining}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":220,"wires":[["9c5631a3a07375d0"]]}]