Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super cool! - Can't get it to compile... #34

Open
doug62 opened this issue Oct 22, 2021 · 4 comments
Open

Super cool! - Can't get it to compile... #34

doug62 opened this issue Oct 22, 2021 · 4 comments
Labels
question Further information is requested

Comments

@doug62
Copy link

doug62 commented Oct 22, 2021

Question

Q1: Where did you obtain swagger/openapi info on HA?

Q2: Can't compile - Tips most welcome (VSC 2021), loaded all repos in same level...

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'MqttRequestContext' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\CommandHandlers\MqttCommandContext.cs 5 Active
Error CS0246 The type or namespace name 'IMqttRequestContext' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\CommandHandlers\MqttCommandContext.cs 10 Active
Error CS0234 The type or namespace name 'ApplicationBuilderConfiguration' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\IMqttEntityControlPanel.cs 8 Active
Error CS0234 The type or namespace name 'ApplicationProvider' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\IMqttEntityControlPanel.cs 9 Active
Error CS0246 The type or namespace name 'IConfigureMqttApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\IMqttEntityControlPanel.cs 14 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\IMqttEntityControlPanel.cs 16 Active
Error CS0234 The type or namespace name 'ApplicationBuilder' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\MqttEntityControlPanel.cs 14 Active
Error CS0234 The type or namespace name 'ApplicationProvider' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\MqttEntityControlPanel.cs 15 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\MqttEntityControlPanel.cs 26 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\MqttEntityControlPanel.cs 42 Active
Error CS0246 The type or namespace name 'IMqttApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\ControlPanel\MqttEntityControlPanel.cs 137 Active
Error CS0234 The type or namespace name 'ApplicationProvider' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\Dispatchers\HomeAssistantOutboundMqttDispatcher.cs 8 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\Dispatchers\HomeAssistantOutboundMqttDispatcher.cs 15 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\Dispatchers\HomeAssistantOutboundMqttDispatcher.cs 22 Active
Error CS0234 The type or namespace name 'ApplicationBuilderConfiguration' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\HomeAssistantServiceCollectionExtensions.cs 8 Active
Error CS0234 The type or namespace name 'ApplicationBuilder' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\BaseMqttEntityBindingManager.cs 14 Active
Error CS0234 The type or namespace name 'ApplicationProvider' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\BaseMqttEntityBindingManager.cs 15 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\BaseMqttEntityBindingManager.cs 28 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\BaseMqttEntityBindingManager.cs 44 Active
Error CS0246 The type or namespace name 'IMqttApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\BaseMqttEntityBindingManager.cs 62 Active
Error CS0234 The type or namespace name 'ApplicationBuilder' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\IMqttEntityBindingManager.cs 8 Active
Error CS0234 The type or namespace name 'ApplicationProvider' does not exist in the namespace 'Sholo.Mqtt' (are you missing an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\IMqttEntityBindingManager.cs 9 Active
Error CS0246 The type or namespace name 'IMqttApplicationProvider' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\IMqttEntityBindingManager.cs 15 Active
Error CS0246 The type or namespace name 'IMqttApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\MqttEntityBindingManagers\IMqttEntityBindingManager.cs 18 Active
Error CS1729 'MqttRequestContext' does not contain a constructor that takes 1 arguments Sholo.HomeAssistant.Mqtt C:\Dev\HomeAssistant\Sholo\Sholo.HomeAssistant\Source\Sholo.HomeAssistant.Mqtt\CommandHandlers\MqttCommandContext.cs 11 Active

@doug62 doug62 added the question Further information is requested label Oct 22, 2021
@scottt732
Copy link
Owner

Hi Doug. Sorry for the delay. I missed the notification. I have a separate library I built on top of MQTT.NET (nuget | github). Everything is still in the alpha/prototype stage, but I have a handful of containers that have been running 24/7 based on these for a few months. I'm working on a rewrite of the MQTT library and was planning to shift back over here.

This library was built by hand by following the REST and Websocket API docs here: https://developers.home-assistant.io/docs/api/rest/. I didn't use any OpenAPI/Swagger tooling to do it. The main library here provides an abstraction over both with an IAsyncEnumerable or IObservable built around the WebSockets API for subscriptions/events and the rest built around the RESTful API.

Separately, I wanted a way to create HomeAssistant devices (sensors/switches/etc.) in code in C#. For that, I followed the docs here: https://www.home-assistant.io/docs/mqtt/discovery/. This is exposed as a separate library/nuget package.

I have containers running at home that are using all of the above in a single application. Basically, I'm subscribing to binary sensors (motion detectors) over the Websockets API and exposing sensors via MQTT discovery that track the amount of "activity" in a room. I'm hoping to open source that at some point but just need to find the time.

@doug62
Copy link
Author

doug62 commented Nov 6, 2021

Wow! - Cool! - Sounds like we have a common design goal but that you are further down the path, However I favor System.Reactive.Linq rather than IAsyncEnumerable (very similar tho), I like HA and want to keep as much of my code there however i wish to extend it a bit by: 1) Exposing virtual devices that use IAsyncEnumerable/Streams to create more nuanced/complex logic, perhaps by dynamically compiling a reactive stream; 2) Scenes - I don't like the current concept of setting a bunch of devices based on a scene, seems more like one wants to apply, push and pop states and that the room should match the state (much like how security policies, router and firewall rules) - A room would have policies like NIGHT | EMPTY, or NIGHT | ENTERTAINMENT | OCCUPIED | MEDIAON, or LATENIGHT | MOTION and then the policies of each 'scene' would be applied/xored/ored sequentially..... Please share any WIP you have, would be nice to contribute as well (once i get this to compile). ALSO - I think that HA scenes are sequential and therefore slow - do you know if z-wave js can handle multi thread/parallel? I would like to speed that up.

@scottt732
Copy link
Owner

I also like Rx. I added IAsyncEnumerable because await foreach on an infinite stream of sensor state changes is a pretty nice model for applications building on this. But either the IAsyncEnumerable implementation here is based on the Rx or the other way around (I can't remember which).

I have some example code that makes it pretty straightforward to consume state changes (Rx/IAsyncEnumerable)/send service calls (REST)/emulate hardware--sensors, switches, etc. (MQTT) all mixed together at a pretty high level of abstraction (not shoehorned together).

My use case for the activity levels system is that I have motion detectors in every room of the house. When one triggers, it increases the activity level by 1.0 (clamped to 0.0 to 5.0 scale) and then gradually cools down over time. I build automations around these sensors instead to handle motion when the room/floor/house is quiet vs. very active. The events bubble up from the room to the floor to the house to the property and cool down at different rates. It makes the house feel much more alive as opposed to binary triggers and has some pretty cool security use cases.

For scenes, the zwave devices are all USB serial devices. I think thats the bottleneck for parallelizing activity on a zwave network. The commands need to be sent sequentially. There are native zwave scenes that can get around this I think to turn on/off or trigger groups of devices at once. Zwavejs2mqtt supports setting these scenes up and HA should let you manipulate them (with or without this library--if they exist in HA they'd be controllable/observable).

@doug62
Copy link
Author

doug62 commented Nov 8, 2021

Direct email? [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants