Big release this time, we are getting closer and closer to beta stage.
NetDaemonApp is abstract
The NetDaemonApp should be an abstract class. The design intent is not to use it directly. Each app in NetDaemon should inherit from it.
Warn users not closing with Execute and ExecuteAsync
Added error message to users if forgetting to close command chains with .Exectute()
or .ExecuteAsync()
. This feature will not do that automatically cause it is important the programmer has full control.
In some cases there is a problem with warning users missing Execute and ExecuteAsync. In those cases the users need to have a way to disable those warnings since it is the intent of the code.
The code below shows example of how to supress missing Execute warnings on a function.
public class SupressLogs : NetDaemonApp
{
[DisableLog(SupressLogType.MissingExecute)]
public override async Task InitializeAsync()
{
// All warnings in this is supressed
Entity("Test");
await DoStuff();
}
public async Task DoStuff()
{
// This is not supressed
Entity("Test");
}
}
PDB information
Also PDB symbols been added to compilation to show more accurate information when something breaks in user
code
Global thread safe shared in-memory storage
Add a global shared in-memory state for safely share objects between apps or within app. In any app you can now use Global[key] = value;
. It is shared statically and uses the ConcurrentDicitionary<string,object>
internally.
Redesign of the reconnect logic
Before: Internally tried to reconnect
Now: Reconnection logic is pushed to the service. This means that with a disconnect from Home assistant the NetDaemon will be reloaded entirenly and everything is in start-up state. Beware that saved memory state is gone when app is reloaded. Use Store
object to persist state that will be reloaded att startup.