nixos-configs/devices/homie/modules/home-assistant/netdaemon/apps/AppModel/TestScript/TestScript.cs
matt1432 919c3cbb66
All checks were successful
Discord / discord commits (push) Has been skipped
feat(netdaemon): make example of a script with params
2024-10-05 14:43:43 -04:00

22 lines
570 B
C#

namespace AppModel;
record ServiceData(string? action, int value);
/// <summary>
/// Showcases how to instance apps with yaml and use automatic configuration population
/// </summary>
[NetDaemonApp]
public class TestScript
{
public TestScript(IHaContext ha)
{
ha.RegisterServiceCallBack<ServiceData>(
"callback_demo",
e => ha.CallService(
"notify",
"persistent_notification",
data: new {message = $"value: {e?.value}", title = $"{e?.action}"}
)
);
}
}