Hi folks, this is a nice but potentially breaking release so pay attension.
Entitystate unavailable are treated as null
The changes the behavior for entity states that are unavailable
. Any state that is unavailable is set to null value. You now do not have to check for unavailable in the scenarios you expect state to be a number as an example.
It can be breaking if you rely on:
if (entity.State == "unavailable") ...
after:
if (entity.State is null) ...
The code below breaks before this release but will be fine this release since State is null if unavailable.
public async override Task InitializeAsync() => Entity("sensor.hacs")
.WhenStateChange((n, o) =>
o?.State != n?.State && n?.State > 0)
.Call(async (entityId, newState, oldState) =>
{
var serviceDataTitle = "Updates pending in HACS";
var serviceDataMessage = "There are updates pending in [HACS](/hacs)\n\n";
List<object> repositories = newState?.Attribute?.repositories || new List<object>();
foreach (IDictionary<string, object?> item in repositories)
{
serviceDataMessage += $"- {item?["display_name"].ToString()}\n";
}
await CallService("persistent_notification", "create", new
{
title = serviceDataTitle,
message = serviceDataMessage
}, true);
}).Execute();
Home Assistant switches for app-switches
This PR is breaking. Before the app id was netdaemon.[appid]
after change switch.netdaemon_[appid]
Makes a real switch of app companion switches. You can now use real Home Assistant switches to turn on/off/toggle apps. As before you need to call netdaemon.reload_apps
to make your changes.