henry-spanka / freeathome-api

Busch-Jaeger free@home API to control actuators
MIT License
45 stars 4 forks source link

Allow api to be used as a library as well #8

Closed ZzAve closed 5 years ago

ZzAve commented 5 years ago

Hi! I'm working on an integration of Free@Home with Homey here: https://github.com/ZzAve/de.buschjaeger.freeathome

My primary goal is to internalise this library, basically bypassing the ws and/or http interface and jacking in to the functionality of your library directly.

My changes in include:

I'm very happy with your work and I think you did a great job taking over from Stefan!

henry-spanka commented 5 years ago

Thanks. I also had that in mind. Some parts of the library are still a mess but it does what it's supposed to do.

The application class still needs to implement the Subscriber interface. Can you please add a commit for that?

Otherwise it looks good. If you like, you can add some documentation to the README on how to use the API as a library. Otherwise I'll do that in a week or so. My laptop is currently being repaired so I'm a bit limited.

henry-spanka commented 5 years ago

And we also need to export the Configuration class. I guess we need to refactor it first and add the ws/http options to a separate class.

ZzAve commented 5 years ago

Thanks for the quick and on-point review! I have noticed that error handling is still very much tightly connected to the Application class and running the api as a process. I tried some refactoring there.

I'll try to do something with the config as well, although for now I've been using the full config, which works as well (the http, ws, and debug part) aren't used yet.

henry-spanka commented 5 years ago

Thanks. I think we can get this merged. Can you please export the Configuration class in the index.ts file? Otherwise we can't use the library externally as we don't have access to the Configuration class which is mandatory.

ZzAve commented 5 years ago

This last commit should do the trick, exposing ClientConfiguration

henry-spanka commented 5 years ago

Many thanks, merged!

I think I will release an updated version next week when I have my laptop back.