snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 56 forks source link

[Help wanted] Publish Homebridge global variables to a KNX group address #129

Closed cyberatz closed 5 years ago

cyberatz commented 5 years ago

Hi, I'm trying to to figure out if there's a way to push existing info from HomeKit to the KNX bus. Concretely, I've installed the 'homebridge-sun-position' plugin which provides sun position (azimuth and altitude) data as a sensor device to HomeKit. I'd like to be able to push this info to specific group addresses on the KNX bus. Is there an existing feature or module available to be able to do this?

Thanks so much for creating this project. It's been incredibly helpful.

snowdd1 commented 5 years ago

Not directly. Maybe you can create an automation in homekit that triggers a homebridge-knx action.
Theoretically, all homebridge plugins can access the data of others, but I would consider that a bad practice.

cyberatz commented 5 years ago

thanks for the response and sorry for the delay. I didn't see the response earlier. The idea is the following: I've done the logic in ETS and this is all presented on the touch panels connected to the KNX bus. The thing is, I'd rather not spend the huge amount of money on a weather station if I can get the same info from a Dark Sky API and homebridge-sun-position plugin. So theoretically, how would one access another plugin data and define that data in the knx_config.json file?

snowdd1 commented 5 years ago

There is no official way to do that. You would need to write some handler that quite brute-forcefully climbs its way up to the global JavaScript objects and then down into the objects of the other plugin. And that’s only possible because there is no private objects to objects (yet) in the language. But it’s definitely not a nice way to code.

snowdd1 commented 5 years ago

I would recommend to try to write a little server that directly translates between the involved parties without using homebridge at all.

cyberatz commented 5 years ago

yeah, I was thinking the same. Might just be easier in the end. thanks for your help.