yllibed / Yllibed.HomeAssistant

Framework to create app-like programs with strong integration into Home Assistant using powerful WebSocket API. This is a fork from rille111/HomeAssistant.AppStarter project.
Apache License 2.0
1 stars 2 forks source link

Refactor for DI and sample AP #5

Open mrgfisher opened 3 years ago

mrgfisher commented 3 years ago

This library is 'just what I'm looking for' and with a few tweaks I've got it working with the original ConsoleExample from rille111's version.

However I would like to tweak the flow relating to dependency injection, perhaps move to .net 5 and repurpose the console example as a reference app. What are your thoughts? I'm happy to take part as contributor, to discuss ideas via this thread, submit PR's or 'just leave it be' :-)

By way of context, my goal is around having a rich and configurable external rule based system for (amongst other things) lights that follow as you move around. Whilst HA is indeed amazing, it doesn't easily lend itself to the dynamic and reactive rules I have - hence shifting this to .Net.

mrgfisher commented 3 years ago

@carldebilly - I've also added retry logic (general exceptions), web socket recreation for cleanly closed connections (e.g. HASS restart) and handling of the cancellation token. The changes are non-breaking and mostly within the StartReceive function of HassAppRunner. Let me know if you're open to a PR or (if easier) I'm very happy to be added as contributor.