feat(zigbee): make use of z2m
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-02-02 16:08:03 -05:00
parent f24026db00
commit 0c7dec7928
4 changed files with 203 additions and 344 deletions

View file

@ -124,16 +124,15 @@ in {
}
];
config.input_text = let
mkPercentInput = name: {
inherit name;
config.input_text = {
bathroom_light_brightness = {
name = "BathroomLightBrightness";
icon = "mdi:lightbulb";
# restricts to 0-100
pattern = "^(0|[1-9][0-9]?|100)$";
initial = "0";
max = 3;
};
in {
bathroom_light_brightness = mkPercentInput "BathroomLightBrightness";
};
lovelaceConfig = {
@ -162,7 +161,7 @@ in {
{
type = "custom:light-entity-card";
entity = "light.tz3210_katchgxy_ts0505b_light";
entity = "light.bathroomceiling";
shorten_cards = false;
consolidate_entities = false;

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Generated using NetDaemon CodeGenerator nd-codegen v24.52.0.0
// At: 2025-02-01T21:14:28.3288568-05:00
// At: 2025-02-02T15:28:09.7289655-05:00
//
// *** Make sure the version of the codegen tool and your nugets NetDaemon.* have the same version.***
// You can use following command to keep it up to date with the latest version:
@ -99,6 +99,7 @@ public static class GeneratedExtensions
serviceCollection.AddTransient<LoggerServices>();
serviceCollection.AddTransient<LovelaceServices>();
serviceCollection.AddTransient<MediaPlayerServices>();
serviceCollection.AddTransient<MqttServices>();
serviceCollection.AddTransient<NetdaemonServices>();
serviceCollection.AddTransient<NotifyServices>();
serviceCollection.AddTransient<NumberServices>();
@ -286,10 +287,10 @@ public partial class LightEntities
/// <summary>Enumerates all light entities currently registered (at runtime) in Home Assistant as LightEntity</summary>
public IEnumerable<LightEntity> EnumerateAll() => _haContext.GetAllEntities().Where(e => e.EntityId.StartsWith("light.")).Select(e => new LightEntity(e));
///<summary>BathroomCeiling</summary>
public LightEntity Bathroomceiling => new(_haContext, "light.bathroomceiling");
///<summary>M5Stack Atom Echo 31196c </summary>
public LightEntity M5stackAtomEcho31196cM5stackAtomEcho31196c => new(_haContext, "light.m5stack_atom_echo_31196c_m5stack_atom_echo_31196c");
///<summary>Bathroom Ceiling Light</summary>
public LightEntity Tz3210KatchgxyTs0505bLight => new(_haContext, "light.tz3210_katchgxy_ts0505b_light");
}
public partial class MediaPlayerEntities
@ -392,6 +393,8 @@ public partial class BinarySensorEntities
public BinarySensorEntity Slzb06p7Ethernet => new(_haContext, "binary_sensor.slzb_06p7_ethernet");
///<summary>SLZB-06p7 Internet</summary>
public BinarySensorEntity Slzb06p7Internet => new(_haContext, "binary_sensor.slzb_06p7_internet");
///<summary>Zigbee2MQTT Bridge Connection state</summary>
public BinarySensorEntity Zigbee2mqttBridgeConnectionState => new(_haContext, "binary_sensor.zigbee2mqtt_bridge_connection_state");
}
public partial class ButtonEntities
@ -412,8 +415,8 @@ public partial class ButtonEntities
public ButtonEntity Slzb06p7CoreRestart => new(_haContext, "button.slzb_06p7_core_restart");
///<summary>SLZB-06p7 Zigbee restart</summary>
public ButtonEntity Slzb06p7ZigbeeRestart => new(_haContext, "button.slzb_06p7_zigbee_restart");
///<summary>_TZ3210_katchgxy TS0505B Identify</summary>
public ButtonEntity Tz3210KatchgxyTs0505bIdentify => new(_haContext, "button.tz3210_katchgxy_ts0505b_identify");
///<summary>Zigbee2MQTT Bridge Restart</summary>
public ButtonEntity Zigbee2mqttBridgeRestart => new(_haContext, "button.zigbee2mqtt_bridge_restart");
}
public partial class CalendarEntities
@ -481,6 +484,8 @@ public partial class InputBooleanEntities
/// <summary>Enumerates all input_boolean entities currently registered (at runtime) in Home Assistant as InputBooleanEntity</summary>
public IEnumerable<InputBooleanEntity> EnumerateAll() => _haContext.GetAllEntities().Where(e => e.EntityId.StartsWith("input_boolean.")).Select(e => new InputBooleanEntity(e));
///<summary>netdaemon_net_daemon_config_apps_frontend_bathroom_light_bathroom_light</summary>
public InputBooleanEntity NetdaemonNetDaemonConfigAppsFrontendBathroomLightBathroomLight => new(_haContext, "input_boolean.netdaemon_net_daemon_config_apps_frontend_bathroom_light_bathroom_light");
///<summary>netdaemon_net_daemon_config_apps_spotify_pause_unpause_pause_unpause</summary>
public InputBooleanEntity NetdaemonNetDaemonConfigAppsSpotifyPauseUnpausePauseUnpause => new(_haContext, "input_boolean.netdaemon_net_daemon_config_apps_spotify_pause_unpause_pause_unpause");
///<summary>netdaemon_net_daemon_config_apps_spotify_play_album_play_album</summary>
@ -615,6 +620,8 @@ public partial class SelectEntities
/// <summary>Enumerates all select entities currently registered (at runtime) in Home Assistant as SelectEntity</summary>
public IEnumerable<SelectEntity> EnumerateAll() => _haContext.GetAllEntities().Where(e => e.EntityId.StartsWith("select.")).Select(e => new SelectEntity(e));
///<summary>BathroomCeiling Color power on behavior</summary>
public SelectEntity BathroomceilingColorPowerOnBehavior => new(_haContext, "select.bathroomceiling_color_power_on_behavior");
///<summary>M5Stack Atom Echo 31196c Assistant</summary>
public SelectEntity M5stackAtomEcho31196cAssistant => new(_haContext, "select.m5stack_atom_echo_31196c_assistant");
///<summary>M5Stack Atom Echo 31196c Finished speaking detection</summary>
@ -633,6 +640,8 @@ public partial class SelectEntities
public SelectEntity Smartplug3InitialState => new(_haContext, "select.smartplug3_initial_state");
///<summary>Smartplug3 Light mode</summary>
public SelectEntity Smartplug3LightMode => new(_haContext, "select.smartplug3_light_mode");
///<summary>Zigbee2MQTT Bridge Log level</summary>
public SelectEntity Zigbee2mqttBridgeLogLevel => new(_haContext, "select.zigbee2mqtt_bridge_log_level");
}
public partial class SensorEntities
@ -741,6 +750,8 @@ public partial class SensorEntities
public SensorEntity SunNextRising => new(_haContext, "sensor.sun_next_rising");
///<summary>Sun Next setting</summary>
public SensorEntity SunNextSetting => new(_haContext, "sensor.sun_next_setting");
///<summary>Zigbee2MQTT Bridge Version</summary>
public SensorEntity Zigbee2mqttBridgeVersion => new(_haContext, "sensor.zigbee2mqtt_bridge_version");
///<summary>Estimated distance</summary>
public NumericSensorEntity Care4b6bEstimatedDistance => new(_haContext, "sensor.care_4b6b_estimated_distance");
///<summary>CODA-4680-FIZ Data received</summary>
@ -787,6 +798,8 @@ public partial class SensorEntities
public NumericSensorEntity SmF741wBatteryLevel => new(_haContext, "sensor.sm_f741w_battery_level");
///<summary>Song tempo</summary>
public NumericSensorEntity SpotifyMattSongTempo => new(_haContext, "sensor.spotify_matt_song_tempo");
///<summary>Zigbee2MQTT Bridge Permit join timeout</summary>
public NumericSensorEntity Zigbee2mqttBridgePermitJoinTimeout => new(_haContext, "sensor.zigbee2mqtt_bridge_permit_join_timeout");
}
public partial class SttEntities
@ -827,6 +840,8 @@ public partial class SwitchEntities
/// <summary>Enumerates all switch entities currently registered (at runtime) in Home Assistant as SwitchEntity</summary>
public IEnumerable<SwitchEntity> EnumerateAll() => _haContext.GetAllEntities().Where(e => e.EntityId.StartsWith("switch.")).Select(e => new SwitchEntity(e));
///<summary>BathroomCeiling Do not disturb</summary>
public SwitchEntity BathroomceilingDoNotDisturb => new(_haContext, "switch.bathroomceiling_do_not_disturb");
///<summary>M5Stack Atom Echo 31196c Use listen light</summary>
public SwitchEntity M5stackAtomEcho31196cUseListenLight => new(_haContext, "switch.m5stack_atom_echo_31196c_use_listen_light");
///<summary>M5Stack Atom Echo 31196c Use wake word</summary>
@ -841,6 +856,8 @@ public partial class SwitchEntities
public SwitchEntity Smartplug2 => new(_haContext, "switch.smartplug2");
///<summary>Office Lamp</summary>
public SwitchEntity Smartplug3 => new(_haContext, "switch.smartplug3");
///<summary>Zigbee2MQTT Bridge Permit join</summary>
public SwitchEntity Zigbee2mqttBridgePermitJoin => new(_haContext, "switch.zigbee2mqtt_bridge_permit_join");
}
public partial class TimerEntities
@ -945,8 +962,6 @@ public partial class UpdateEntities
public UpdateEntity Slzb06p7CoreFirmware => new(_haContext, "update.slzb_06p7_core_firmware");
///<summary>SLZB-06p7 Zigbee firmware</summary>
public UpdateEntity Slzb06p7ZigbeeFirmware => new(_haContext, "update.slzb_06p7_zigbee_firmware");
///<summary>_TZ3210_katchgxy TS0505B Firmware</summary>
public UpdateEntity Tz3210KatchgxyTs0505bFirmware => new(_haContext, "update.tz3210_katchgxy_ts0505b_firmware");
}
public partial class InputNumberEntities
@ -1040,6 +1055,18 @@ public partial record LightAttributes
[JsonPropertyName("restored")]
public bool? Restored { get; init; }
[JsonPropertyName("color_options")]
public object? ColorOptions { get; init; }
[JsonPropertyName("color_power_on_behavior")]
public object? ColorPowerOnBehavior { get; init; }
[JsonPropertyName("do_not_disturb")]
public object? DoNotDisturb { get; init; }
[JsonPropertyName("linkquality")]
public object? Linkquality { get; init; }
}
public partial record MediaPlayerEntity : Entity<MediaPlayerEntity, EntityState<MediaPlayerAttributes>, MediaPlayerAttributes>, IMediaPlayerEntityCore
@ -1681,6 +1708,30 @@ public partial record SelectAttributes
[JsonPropertyName("supported_features")]
public double? SupportedFeatures { get; init; }
[JsonPropertyName("brightness")]
public double? Brightness { get; init; }
[JsonPropertyName("color")]
public object? Color { get; init; }
[JsonPropertyName("color_mode")]
public string? ColorMode { get; init; }
[JsonPropertyName("color_options")]
public object? ColorOptions { get; init; }
[JsonPropertyName("color_power_on_behavior")]
public object? ColorPowerOnBehavior { get; init; }
[JsonPropertyName("color_temp")]
public double? ColorTemp { get; init; }
[JsonPropertyName("do_not_disturb")]
public object? DoNotDisturb { get; init; }
[JsonPropertyName("linkquality")]
public object? Linkquality { get; init; }
}
public partial record SensorEntity : Entity<SensorEntity, EntityState<SensorAttributes>, SensorAttributes>, ISensorEntityCore
@ -1934,6 +1985,33 @@ public partial record SwitchAttributes
[JsonPropertyName("supported_features")]
public double? SupportedFeatures { get; init; }
[JsonPropertyName("icon")]
public string? Icon { get; init; }
[JsonPropertyName("brightness")]
public double? Brightness { get; init; }
[JsonPropertyName("color")]
public object? Color { get; init; }
[JsonPropertyName("color_mode")]
public string? ColorMode { get; init; }
[JsonPropertyName("color_options")]
public object? ColorOptions { get; init; }
[JsonPropertyName("color_power_on_behavior")]
public object? ColorPowerOnBehavior { get; init; }
[JsonPropertyName("color_temp")]
public double? ColorTemp { get; init; }
[JsonPropertyName("do_not_disturb")]
public object? DoNotDisturb { get; init; }
[JsonPropertyName("linkquality")]
public object? Linkquality { get; init; }
}
public partial record TimerEntity : Entity<TimerEntity, EntityState<TimerAttributes>, TimerAttributes>, ITimerEntityCore
@ -2265,6 +2343,8 @@ public interface IServices
MediaPlayerServices MediaPlayer { get; }
MqttServices Mqtt { get; }
NetdaemonServices Netdaemon { get; }
NotifyServices Notify { get; }
@ -2359,6 +2439,7 @@ public partial class Services : IServices
public LoggerServices Logger => new(_haContext);
public LovelaceServices Lovelace => new(_haContext);
public MediaPlayerServices MediaPlayer => new(_haContext);
public MqttServices Mqtt => new(_haContext);
public NetdaemonServices Netdaemon => new(_haContext);
public NotifyServices Notify => new(_haContext);
public NumberServices Number => new(_haContext);
@ -4938,6 +5019,86 @@ public partial record MediaPlayerVolumeSetParameters
public double? VolumeLevel { get; init; }
}
public partial class MqttServices
{
private readonly IHaContext _haContext;
public MqttServices(IHaContext haContext)
{
_haContext = haContext;
}
///<summary>Writes all messages on a specific topic into the `mqtt_dump.txt` file in your configuration folder.</summary>
public void Dump(MqttDumpParameters data)
{
_haContext.CallService("mqtt", "dump", null, data);
}
///<summary>Writes all messages on a specific topic into the `mqtt_dump.txt` file in your configuration folder.</summary>
///<param name="topic">Topic to listen to. eg: OpenZWave/#</param>
///<param name="duration">How long we should listen for messages in seconds.</param>
public void Dump(string? topic = null, double? duration = null)
{
_haContext.CallService("mqtt", "dump", null, new MqttDumpParameters { Topic = topic, Duration = duration });
}
///<summary>Publishes a message to an MQTT topic.</summary>
public void Publish(MqttPublishParameters data)
{
_haContext.CallService("mqtt", "publish", null, data);
}
///<summary>Publishes a message to an MQTT topic.</summary>
///<param name="topic">Topic to publish to. eg: /homeassistant/hello</param>
///<param name="payload">The payload to publish. eg: The temperature is {{ states(&apos;sensor.temperature&apos;) }}</param>
///<param name="evaluatePayload">When `payload` is a Python bytes literal, evaluate the bytes literal and publish the raw data.</param>
///<param name="qos">Quality of Service to use. 0: At most once. 1: At least once. 2: Exactly once.</param>
///<param name="retain">If the message should have the retain flag set. If set, the broker stores the most recent message on a topic.</param>
public void Publish(string topic, object payload, bool? evaluatePayload = null, object? qos = null, bool? retain = null)
{
_haContext.CallService("mqtt", "publish", null, new MqttPublishParameters { Topic = topic, Payload = payload, EvaluatePayload = evaluatePayload, Qos = qos, Retain = retain });
}
///<summary>Reloads MQTT entities from the YAML-configuration.</summary>
public void Reload(object? data = null)
{
_haContext.CallService("mqtt", "reload", null, data);
}
}
public partial record MqttDumpParameters
{
///<summary>Topic to listen to. eg: OpenZWave/#</summary>
[JsonPropertyName("topic")]
public string? Topic { get; init; }
///<summary>How long we should listen for messages in seconds.</summary>
[JsonPropertyName("duration")]
public double? Duration { get; init; }
}
public partial record MqttPublishParameters
{
///<summary>Topic to publish to. eg: /homeassistant/hello</summary>
[JsonPropertyName("topic")]
public string? Topic { get; init; }
///<summary>The payload to publish. eg: The temperature is {{ states(&apos;sensor.temperature&apos;) }}</summary>
[JsonPropertyName("payload")]
public object? Payload { get; init; }
///<summary>When `payload` is a Python bytes literal, evaluate the bytes literal and publish the raw data.</summary>
[JsonPropertyName("evaluate_payload")]
public bool? EvaluatePayload { get; init; }
///<summary>Quality of Service to use. 0: At most once. 1: At least once. 2: Exactly once.</summary>
[JsonPropertyName("qos")]
public object? Qos { get; init; }
///<summary>If the message should have the retain flag set. If set, the broker stores the most recent message on a topic.</summary>
[JsonPropertyName("retain")]
public bool? Retain { get; init; }
}
public partial class NetdaemonServices
{
private readonly IHaContext _haContext;
@ -6151,7 +6312,7 @@ public partial class SpotifyplusServices
///<param name="entityId">Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. eg: media_player.spotifyplus_username</param>
///<param name="uris">A list of Spotify track or episode URIs to add to the queue (spotify:track:6zd8T1PBe9JFHmuVnurdRp, spotify:track:1kWUud3vY5ij5r62zxpTRy); values can be track or episode URIs. All URIs must be of the same type - you cannot mix and match tracks and episodes. An unlimited number of items can be added in one request, but the more items the longer it will take. eg: spotify:track:6zd8T1PBe9JFHmuVnurdRp</param>
///<param name="deviceId">The id or name of the Spotify Connect Player device this command is targeting. If not supplied, the user&apos;s currently active device is the target. If no device is active (or an &apos;*&apos; is specified), then the SpotifyPlus default device is activated. eg: 0d1841b0976bae2a3a310dd74c0f337465899bc8</param>
///<param name="verifyDeviceId">True to verify a device id is active; otherwise, false to assume that a device id is already active. Default is True. eg: True</param>
///<param name="verifyDeviceId">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="delay">Time delay (in seconds) to wait AFTER issuing the add request (if necessary). This delay will give the spotify web api time to process the change before another command is issued. Default is 0.15; value range is 0 - 10. eg: 0.15</param>
public void AddPlayerQueueItems(string entityId, string uris, string? deviceId = null, bool? verifyDeviceId = null, double? delay = null)
{
@ -7509,9 +7670,9 @@ public partial class SpotifyplusServices
///<summary>Get information about a specific Spotify Connect player device, and (optionally) activate the device if it requires it.</summary>
///<param name="entityId">Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. eg: media_player.spotifyplus_username</param>
///<param name="deviceValue">The id (e.g. &apos;30fbc80e35598f3c242f2120413c943dfd9715fe&apos;) or name (e.g. &apos;Office&apos;) of the Spotify Connect Player device this command is targeting. If an &apos;*&apos; is specified, then the SpotifyPlus default device is used. eg: Bose-ST10-1</param>
///<param name="verifyUserContext">If True, the active user context of the resolved device is checked to ensure it matches the Spotify Connect user context specified in the SpotifyPlus configuration options. If False, the user context will not be checked. Default is True. eg: True</param>
///<param name="verifyUserContext">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="verifyTimeout">Maximum time to wait (in seconds) for the device to become active in the Spotify Connect device list. This value is only used if a Connect command has to be issued to activate the device. Default is 5; value range is 0 - 10. eg: 0.50</param>
///<param name="refreshDeviceList">True to refresh the Spotify Connect device list; otherwise, False to use the Spotify Connect device list cache. Default is True. eg: True</param>
///<param name="refreshDeviceList">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="activateDevice">True to activate the device if necessary; otherwise, False. eg: True</param>
///<param name="delay">Time delay (in seconds) to wait AFTER issuing any command to the device. This delay will give the spotify zeroconf api time to process the change before another command is issued. Default is 0.25; value range is 0 - 10. eg: 0.25</param>
public void GetSpotifyConnectDevice(string entityId, string deviceValue, bool? verifyUserContext = null, double? verifyTimeout = null, bool? refreshDeviceList = null, bool? activateDevice = null, double? delay = null)
@ -7528,9 +7689,9 @@ public partial class SpotifyplusServices
///<summary>Get information about a specific Spotify Connect player device, and (optionally) activate the device if it requires it.</summary>
///<param name="entityId">Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. eg: media_player.spotifyplus_username</param>
///<param name="deviceValue">The id (e.g. &apos;30fbc80e35598f3c242f2120413c943dfd9715fe&apos;) or name (e.g. &apos;Office&apos;) of the Spotify Connect Player device this command is targeting. If an &apos;*&apos; is specified, then the SpotifyPlus default device is used. eg: Bose-ST10-1</param>
///<param name="verifyUserContext">If True, the active user context of the resolved device is checked to ensure it matches the Spotify Connect user context specified in the SpotifyPlus configuration options. If False, the user context will not be checked. Default is True. eg: True</param>
///<param name="verifyUserContext">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="verifyTimeout">Maximum time to wait (in seconds) for the device to become active in the Spotify Connect device list. This value is only used if a Connect command has to be issued to activate the device. Default is 5; value range is 0 - 10. eg: 0.50</param>
///<param name="refreshDeviceList">True to refresh the Spotify Connect device list; otherwise, False to use the Spotify Connect device list cache. Default is True. eg: True</param>
///<param name="refreshDeviceList">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="activateDevice">True to activate the device if necessary; otherwise, False. eg: True</param>
///<param name="delay">Time delay (in seconds) to wait AFTER issuing any command to the device. This delay will give the spotify zeroconf api time to process the change before another command is issued. Default is 0.25; value range is 0 - 10. eg: 0.25</param>
public Task<JsonElement?> GetSpotifyConnectDeviceAsync(string entityId, string deviceValue, bool? verifyUserContext = null, double? verifyTimeout = null, bool? refreshDeviceList = null, bool? activateDevice = null, double? delay = null)
@ -7547,7 +7708,7 @@ public partial class SpotifyplusServices
///<summary>Get information about all available Spotify Connect player (both static and dynamic) devices.</summary>
///<param name="entityId">Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. eg: media_player.spotifyplus_username</param>
///<param name="refresh">True (default) to return real-time information from the spotify zeroconf api and update the cache; otherwise, False to just return the cached value. eg: True</param>
///<param name="sortResult">True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them. eg: True</param>
///<param name="sortResult">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
public void GetSpotifyConnectDevices(string entityId, bool? refresh = null, bool? sortResult = null)
{
_haContext.CallService("spotifyplus", "get_spotify_connect_devices", null, new SpotifyplusGetSpotifyConnectDevicesParameters { EntityId = entityId, Refresh = refresh, SortResult = sortResult });
@ -7562,7 +7723,7 @@ public partial class SpotifyplusServices
///<summary>Get information about all available Spotify Connect player (both static and dynamic) devices.</summary>
///<param name="entityId">Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. eg: media_player.spotifyplus_username</param>
///<param name="refresh">True (default) to return real-time information from the spotify zeroconf api and update the cache; otherwise, False to just return the cached value. eg: True</param>
///<param name="sortResult">True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them. eg: True</param>
///<param name="sortResult">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
public Task<JsonElement?> GetSpotifyConnectDevicesAsync(string entityId, bool? refresh = null, bool? sortResult = null)
{
return _haContext.CallServiceWithResponseAsync("spotifyplus", "get_spotify_connect_devices", null, new SpotifyplusGetSpotifyConnectDevicesParameters { EntityId = entityId, Refresh = refresh, SortResult = sortResult });
@ -7897,7 +8058,7 @@ public partial class SpotifyplusServices
///<param name="deviceId">The id or name of the Spotify Connect Player device this command is targeting. If not supplied, the user&apos;s currently active device is the target. If no device is active (or an &apos;*&apos; is specified), then the SpotifyPlus default device is activated. eg: 0d1841b0976bae2a3a310dd74c0f337465899bc8</param>
///<param name="shuffle">True to set player shuffle mode to on; otherwise, False for no shuffle. eg: True</param>
///<param name="delay">Time delay (in seconds) to wait AFTER issuing the command to the player. This delay will give the spotify web api time to process the change before another command is issued. Default is 0.50; value range is 0 - 10. eg: 0.50</param>
///<param name="resolveDeviceId">True to resolve the supplied `deviceId` value; otherwise, False not resolve the `deviceId` value as it has already been resolved. Default is True. eg: True</param>
///<param name="resolveDeviceId">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="limitTotal">The maximum number of items to retrieve from favorites. Default is 200; Range is 1 - 750. eg: 200</param>
public void PlayerMediaPlayTrackFavorites(string entityId, string? deviceId = null, bool? shuffle = null, double? delay = null, bool? resolveDeviceId = null, double? limitTotal = null)
{
@ -8042,7 +8203,7 @@ public partial class SpotifyplusServices
///<param name="deviceId">The id or name of the Spotify Connect Player device on which playback should be started/transferred. If no device is specified, then the SpotifyPlus default device is activated. eg: 0d1841b0976bae2a3a310dd74c0f337465899bc8</param>
///<param name="play">True (default) to start playback on the new device; otherise, False to keep the current playback state on the existing device. eg: True</param>
///<param name="delay">Time delay (in seconds) to wait AFTER issuing the final Connect command (if necessary). This delay will give the spotify web api time to process the device list change before another command is issued. Default is 0.50; value range is 0 - 10. eg: 0.50</param>
///<param name="refreshDeviceList">True to refresh the Spotify Connect device list; otherwise, False to use the Spotify Connect device list cache. Default is True. eg: True</param>
///<param name="refreshDeviceList">DEPRECATED - no longer used, but left here to maintain compatibility.</param>
///<param name="forceActivateDevice">True to issue a Spotify Connect Disconnect call prior to transfer, which will force the device to reconnect to Spotify Connect; otherwise, False to not disconnect. Default is True. eg: True</param>
///<param name="deviceIdFrom">The player device identifier where play is being transferred from; only used to stop play on restricted devices prior to transferring playback. eg: Office</param>
public void PlayerTransferPlayback(string entityId, string? deviceId = null, bool? play = null, double? delay = null, bool? refreshDeviceList = null, bool? forceActivateDevice = null, string? deviceIdFrom = null)
@ -8893,7 +9054,7 @@ public partial record SpotifyplusAddPlayerQueueItemsParameters
[JsonPropertyName("device_id")]
public string? DeviceId { get; init; }
///<summary>True to verify a device id is active; otherwise, false to assume that a device id is already active. Default is True. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("verify_device_id")]
public bool? VerifyDeviceId { get; init; }
@ -9732,7 +9893,7 @@ public partial record SpotifyplusGetSpotifyConnectDeviceParameters
[JsonPropertyName("device_value")]
public string? DeviceValue { get; init; }
///<summary>If True, the active user context of the resolved device is checked to ensure it matches the Spotify Connect user context specified in the SpotifyPlus configuration options. If False, the user context will not be checked. Default is True. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("verify_user_context")]
public bool? VerifyUserContext { get; init; }
@ -9740,7 +9901,7 @@ public partial record SpotifyplusGetSpotifyConnectDeviceParameters
[JsonPropertyName("verify_timeout")]
public double? VerifyTimeout { get; init; }
///<summary>True to refresh the Spotify Connect device list; otherwise, False to use the Spotify Connect device list cache. Default is True. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("refresh_device_list")]
public bool? RefreshDeviceList { get; init; }
@ -9763,7 +9924,7 @@ public partial record SpotifyplusGetSpotifyConnectDevicesParameters
[JsonPropertyName("refresh")]
public bool? Refresh { get; init; }
///<summary>True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("sort_result")]
public bool? SortResult { get; init; }
}
@ -10130,7 +10291,7 @@ public partial record SpotifyplusPlayerMediaPlayTrackFavoritesParameters
[JsonPropertyName("delay")]
public double? Delay { get; init; }
///<summary>True to resolve the supplied `deviceId` value; otherwise, False not resolve the `deviceId` value as it has already been resolved. Default is True. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("resolve_device_id")]
public bool? ResolveDeviceId { get; init; }
@ -10305,7 +10466,7 @@ public partial record SpotifyplusPlayerTransferPlaybackParameters
[JsonPropertyName("delay")]
public double? Delay { get; init; }
///<summary>True to refresh the Spotify Connect device list; otherwise, False to use the Spotify Connect device list cache. Default is True. eg: True</summary>
///<summary>DEPRECATED - no longer used, but left here to maintain compatibility.</summary>
[JsonPropertyName("refresh_device_list")]
public bool? RefreshDeviceList { get; init; }
@ -11723,75 +11884,6 @@ public partial class ZhaServices
_haContext.CallService("zha", "enable_lock_user_code", target, new ZhaEnableLockUserCodeParameters { CodeSlot = codeSlot });
}
///<summary>Issues a command on the specified cluster on the specified entity.</summary>
public void IssueZigbeeClusterCommand(ZhaIssueZigbeeClusterCommandParameters data)
{
_haContext.CallService("zha", "issue_zigbee_cluster_command", null, data);
}
///<summary>Issues a command on the specified cluster on the specified entity.</summary>
///<param name="ieee">IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</param>
///<param name="endpointId">Endpoint ID for the cluster.</param>
///<param name="clusterId">ZCL cluster to retrieve attributes for.</param>
///<param name="clusterType">Type of the cluster.</param>
///<param name="command">ID of the command to execute.</param>
///<param name="commandType">Type of the command to execute.</param>
///<param name="args">Arguments to pass to the command. eg: [arg1, arg2, argN]</param>
///<param name="params">Parameters to pass to the command.</param>
///<param name="manufacturer">Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</param>
public void IssueZigbeeClusterCommand(string ieee, double endpointId, double clusterId, double command, object commandType, object? clusterType = null, object? args = null, object? @params = null, string? manufacturer = null)
{
_haContext.CallService("zha", "issue_zigbee_cluster_command", null, new ZhaIssueZigbeeClusterCommandParameters { Ieee = ieee, EndpointId = endpointId, ClusterId = clusterId, ClusterType = clusterType, Command = command, CommandType = commandType, Args = args, Params = @params, Manufacturer = manufacturer });
}
///<summary>Issue command on the specified cluster on the specified group.</summary>
public void IssueZigbeeGroupCommand(ZhaIssueZigbeeGroupCommandParameters data)
{
_haContext.CallService("zha", "issue_zigbee_group_command", null, data);
}
///<summary>Issue command on the specified cluster on the specified group.</summary>
///<param name="group">Hexadecimal address of the group. eg: 546</param>
///<param name="clusterId">ZCL cluster to send command to.</param>
///<param name="clusterType">Type of the cluster.</param>
///<param name="command">ID of the command to execute.</param>
///<param name="args">Arguments to pass to the command. eg: [arg1, arg2, argN]</param>
///<param name="manufacturer">Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</param>
public void IssueZigbeeGroupCommand(string @group, double clusterId, double command, object? clusterType = null, object? args = null, string? manufacturer = null)
{
_haContext.CallService("zha", "issue_zigbee_group_command", null, new ZhaIssueZigbeeGroupCommandParameters { Group = @group, ClusterId = clusterId, ClusterType = clusterType, Command = command, Args = args, Manufacturer = manufacturer });
}
///<summary>Allows nodes to join the Zigbee network.</summary>
public void Permit(ZhaPermitParameters data)
{
_haContext.CallService("zha", "permit", null, data);
}
///<summary>Allows nodes to join the Zigbee network.</summary>
///<param name="duration">Time to permit joins.</param>
///<param name="ieee">IEEE address of the node permitting new joins. eg: 00:0d:6f:00:05:7d:2d:34</param>
///<param name="sourceIeee">IEEE address of the joining device (must be used with the install code). eg: 00:0a:bf:00:01:10:23:35</param>
///<param name="installCode">Install code of the joining device (must be used with the source_ieee). eg: 1234-5678-1234-5678-AABB-CCDD-AABB-CCDD-EEFF</param>
///<param name="qrCode">Value of the QR install code (different between vendors). eg: Z:000D6FFFFED4163B$I:52797BF4A5084DAA8E1712B61741CA024051</param>
public void Permit(double? duration = null, string? ieee = null, string? sourceIeee = null, string? installCode = null, string? qrCode = null)
{
_haContext.CallService("zha", "permit", null, new ZhaPermitParameters { Duration = duration, Ieee = ieee, SourceIeee = sourceIeee, InstallCode = installCode, QrCode = qrCode });
}
///<summary>Removes a node from the Zigbee network.</summary>
public void Remove(ZhaRemoveParameters data)
{
_haContext.CallService("zha", "remove", null, data);
}
///<summary>Removes a node from the Zigbee network.</summary>
///<param name="ieee">IEEE address of the node to remove. eg: 00:0d:6f:00:05:7d:2d:34</param>
public void Remove(string ieee)
{
_haContext.CallService("zha", "remove", null, new ZhaRemoveParameters { Ieee = ieee });
}
///<summary>Sets a user code on a lock.</summary>
///<param name="target">The target for this service call</param>
public void SetLockUserCode(ServiceTarget target, ZhaSetLockUserCodeParameters data)
@ -11806,60 +11898,6 @@ public partial class ZhaServices
{
_haContext.CallService("zha", "set_lock_user_code", target, new ZhaSetLockUserCodeParameters { CodeSlot = codeSlot, UserCode = userCode });
}
///<summary>Sets an attribute value for the specified cluster on the specified entity.</summary>
public void SetZigbeeClusterAttribute(ZhaSetZigbeeClusterAttributeParameters data)
{
_haContext.CallService("zha", "set_zigbee_cluster_attribute", null, data);
}
///<summary>Sets an attribute value for the specified cluster on the specified entity.</summary>
///<param name="ieee">IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</param>
///<param name="endpointId">Endpoint ID for the cluster.</param>
///<param name="clusterId">ZCL cluster to retrieve attributes for.</param>
///<param name="clusterType">Type of the cluster.</param>
///<param name="attribute">ID of the attribute to set. eg: 0</param>
///<param name="value">Value to write to the attribute. eg: 1</param>
///<param name="manufacturer">Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</param>
public void SetZigbeeClusterAttribute(string ieee, double endpointId, double clusterId, double attribute, string value, object? clusterType = null, string? manufacturer = null)
{
_haContext.CallService("zha", "set_zigbee_cluster_attribute", null, new ZhaSetZigbeeClusterAttributeParameters { Ieee = ieee, EndpointId = endpointId, ClusterId = clusterId, ClusterType = clusterType, Attribute = attribute, Value = value, Manufacturer = manufacturer });
}
///<summary>This action uses the WD capabilities to emit a quick audible/visible pulse called a &quot;squawk&quot;. The squawk command has no effect if the WD is currently active (warning in progress).</summary>
public void WarningDeviceSquawk(ZhaWarningDeviceSquawkParameters data)
{
_haContext.CallService("zha", "warning_device_squawk", null, data);
}
///<summary>This action uses the WD capabilities to emit a quick audible/visible pulse called a &quot;squawk&quot;. The squawk command has no effect if the WD is currently active (warning in progress).</summary>
///<param name="ieee">IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</param>
///<param name="mode">The Squawk Mode field is used as a 4-bit enumeration, and can have one of the values shown in Table 8-24 of the ZCL spec - Squawk Mode Field. The exact operation of each mode (how the WD “squawks”) is implementation specific.</param>
///<param name="strobe">The strobe field is used as a Boolean, and determines if the visual indication is also required in addition to the audible squawk, as shown in Table 8-25 of the ZCL spec - Strobe Bit.</param>
///<param name="level">The squawk level field is used as a 2-bit enumeration, and determines the intensity of audible squawk sound as shown in Table 8-26 of the ZCL spec - Squawk Level Field Values.</param>
public void WarningDeviceSquawk(string ieee, double? mode = null, double? strobe = null, double? level = null)
{
_haContext.CallService("zha", "warning_device_squawk", null, new ZhaWarningDeviceSquawkParameters { Ieee = ieee, Mode = mode, Strobe = strobe, Level = level });
}
///<summary>This action starts the operation of the warning device. The warning device alerts the surrounding area by audible (siren) and visual (strobe) signals.</summary>
public void WarningDeviceWarn(ZhaWarningDeviceWarnParameters data)
{
_haContext.CallService("zha", "warning_device_warn", null, data);
}
///<summary>This action starts the operation of the warning device. The warning device alerts the surrounding area by audible (siren) and visual (strobe) signals.</summary>
///<param name="ieee">IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</param>
///<param name="mode">The Warning Mode field is used as a 4-bit enumeration, can have one of the values 0-6 defined below in table 8-20 of the ZCL spec. The exact behavior of the warning device in each mode is according to the relevant security standards.</param>
///<param name="strobe">The Strobe field is used as a 2-bit enumeration, and determines if the visual indication is required in addition to the audible siren, as indicated in Table 8-21 of the ZCL spec. &quot;0&quot; means no strobe, &quot;1&quot; means strobe. If the strobe field is “1” and the Warning Mode is “0” (“Stop”), then only the strobe is activated.</param>
///<param name="level">The Siren Level field is used as a 2-bit enumeration, and indicates the intensity of audible squawk sound as shown in Table 8-22 of the ZCL spec.</param>
///<param name="duration">Requested duration of warning, in seconds (16 bit). If both Strobe and Warning Mode are &quot;0&quot; this field is ignored.</param>
///<param name="dutyCycle">Indicates the length of the flash cycle. This allows you to vary the flash duration for different alarm types (e.g., fire, police, burglar). The valid range is 0-100 in increments of 10. All other values must be rounded to the nearest valid value. Strobe calculates a duty cycle over a duration of one second. The ON state must precede the OFF state. For example, if the Strobe Duty Cycle field specifies “40,”, then the strobe flashes ON for 4/10ths of a second and then turns OFF for 6/10ths of a second.</param>
///<param name="intensity">Indicates the intensity of the strobe as shown in Table 8-23 of the ZCL spec. This attribute is designed to vary the output of the strobe (i.e., brightness) and not its frequency, which is detailed in section 8.4.2.3.1.6 of the ZCL spec.</param>
public void WarningDeviceWarn(string ieee, double? mode = null, double? strobe = null, double? level = null, double? duration = null, long? dutyCycle = null, double? intensity = null)
{
_haContext.CallService("zha", "warning_device_warn", null, new ZhaWarningDeviceWarnParameters { Ieee = ieee, Mode = mode, Strobe = strobe, Level = level, Duration = duration, DutyCycle = dutyCycle, Intensity = intensity });
}
}
public partial record ZhaClearLockUserCodeParameters
@ -11883,102 +11921,6 @@ public partial record ZhaEnableLockUserCodeParameters
public string? CodeSlot { get; init; }
}
public partial record ZhaIssueZigbeeClusterCommandParameters
{
///<summary>IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
///<summary>Endpoint ID for the cluster.</summary>
[JsonPropertyName("endpoint_id")]
public double? EndpointId { get; init; }
///<summary>ZCL cluster to retrieve attributes for.</summary>
[JsonPropertyName("cluster_id")]
public double? ClusterId { get; init; }
///<summary>Type of the cluster.</summary>
[JsonPropertyName("cluster_type")]
public object? ClusterType { get; init; }
///<summary>ID of the command to execute.</summary>
[JsonPropertyName("command")]
public double? Command { get; init; }
///<summary>Type of the command to execute.</summary>
[JsonPropertyName("command_type")]
public object? CommandType { get; init; }
///<summary>Arguments to pass to the command. eg: [arg1, arg2, argN]</summary>
[JsonPropertyName("args")]
public object? Args { get; init; }
///<summary>Parameters to pass to the command.</summary>
[JsonPropertyName("params")]
public object? Params { get; init; }
///<summary>Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</summary>
[JsonPropertyName("manufacturer")]
public string? Manufacturer { get; init; }
}
public partial record ZhaIssueZigbeeGroupCommandParameters
{
///<summary>Hexadecimal address of the group. eg: 546</summary>
[JsonPropertyName("group")]
public string? Group { get; init; }
///<summary>ZCL cluster to send command to.</summary>
[JsonPropertyName("cluster_id")]
public double? ClusterId { get; init; }
///<summary>Type of the cluster.</summary>
[JsonPropertyName("cluster_type")]
public object? ClusterType { get; init; }
///<summary>ID of the command to execute.</summary>
[JsonPropertyName("command")]
public double? Command { get; init; }
///<summary>Arguments to pass to the command. eg: [arg1, arg2, argN]</summary>
[JsonPropertyName("args")]
public object? Args { get; init; }
///<summary>Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</summary>
[JsonPropertyName("manufacturer")]
public string? Manufacturer { get; init; }
}
public partial record ZhaPermitParameters
{
///<summary>Time to permit joins.</summary>
[JsonPropertyName("duration")]
public double? Duration { get; init; }
///<summary>IEEE address of the node permitting new joins. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
///<summary>IEEE address of the joining device (must be used with the install code). eg: 00:0a:bf:00:01:10:23:35</summary>
[JsonPropertyName("source_ieee")]
public string? SourceIeee { get; init; }
///<summary>Install code of the joining device (must be used with the source_ieee). eg: 1234-5678-1234-5678-AABB-CCDD-AABB-CCDD-EEFF</summary>
[JsonPropertyName("install_code")]
public string? InstallCode { get; init; }
///<summary>Value of the QR install code (different between vendors). eg: Z:000D6FFFFED4163B$I:52797BF4A5084DAA8E1712B61741CA024051</summary>
[JsonPropertyName("qr_code")]
public string? QrCode { get; init; }
}
public partial record ZhaRemoveParameters
{
///<summary>IEEE address of the node to remove. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
}
public partial record ZhaSetLockUserCodeParameters
{
///<summary>Code slot to set the code in. eg: 1</summary>
@ -11990,87 +11932,6 @@ public partial record ZhaSetLockUserCodeParameters
public string? UserCode { get; init; }
}
public partial record ZhaSetZigbeeClusterAttributeParameters
{
///<summary>IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
///<summary>Endpoint ID for the cluster.</summary>
[JsonPropertyName("endpoint_id")]
public double? EndpointId { get; init; }
///<summary>ZCL cluster to retrieve attributes for.</summary>
[JsonPropertyName("cluster_id")]
public double? ClusterId { get; init; }
///<summary>Type of the cluster.</summary>
[JsonPropertyName("cluster_type")]
public object? ClusterType { get; init; }
///<summary>ID of the attribute to set. eg: 0</summary>
[JsonPropertyName("attribute")]
public double? Attribute { get; init; }
///<summary>Value to write to the attribute. eg: 1</summary>
[JsonPropertyName("value")]
public string? Value { get; init; }
///<summary>Manufacturer code. Use a value of &quot;-1&quot; to force no code to be set. eg: 252</summary>
[JsonPropertyName("manufacturer")]
public string? Manufacturer { get; init; }
}
public partial record ZhaWarningDeviceSquawkParameters
{
///<summary>IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
///<summary>The Squawk Mode field is used as a 4-bit enumeration, and can have one of the values shown in Table 8-24 of the ZCL spec - Squawk Mode Field. The exact operation of each mode (how the WD “squawks”) is implementation specific.</summary>
[JsonPropertyName("mode")]
public double? Mode { get; init; }
///<summary>The strobe field is used as a Boolean, and determines if the visual indication is also required in addition to the audible squawk, as shown in Table 8-25 of the ZCL spec - Strobe Bit.</summary>
[JsonPropertyName("strobe")]
public double? Strobe { get; init; }
///<summary>The squawk level field is used as a 2-bit enumeration, and determines the intensity of audible squawk sound as shown in Table 8-26 of the ZCL spec - Squawk Level Field Values.</summary>
[JsonPropertyName("level")]
public double? Level { get; init; }
}
public partial record ZhaWarningDeviceWarnParameters
{
///<summary>IEEE address for the device. eg: 00:0d:6f:00:05:7d:2d:34</summary>
[JsonPropertyName("ieee")]
public string? Ieee { get; init; }
///<summary>The Warning Mode field is used as a 4-bit enumeration, can have one of the values 0-6 defined below in table 8-20 of the ZCL spec. The exact behavior of the warning device in each mode is according to the relevant security standards.</summary>
[JsonPropertyName("mode")]
public double? Mode { get; init; }
///<summary>The Strobe field is used as a 2-bit enumeration, and determines if the visual indication is required in addition to the audible siren, as indicated in Table 8-21 of the ZCL spec. &quot;0&quot; means no strobe, &quot;1&quot; means strobe. If the strobe field is “1” and the Warning Mode is “0” (“Stop”), then only the strobe is activated.</summary>
[JsonPropertyName("strobe")]
public double? Strobe { get; init; }
///<summary>The Siren Level field is used as a 2-bit enumeration, and indicates the intensity of audible squawk sound as shown in Table 8-22 of the ZCL spec.</summary>
[JsonPropertyName("level")]
public double? Level { get; init; }
///<summary>Requested duration of warning, in seconds (16 bit). If both Strobe and Warning Mode are &quot;0&quot; this field is ignored.</summary>
[JsonPropertyName("duration")]
public double? Duration { get; init; }
///<summary>Indicates the length of the flash cycle. This allows you to vary the flash duration for different alarm types (e.g., fire, police, burglar). The valid range is 0-100 in increments of 10. All other values must be rounded to the nearest valid value. Strobe calculates a duty cycle over a duration of one second. The ON state must precede the OFF state. For example, if the Strobe Duty Cycle field specifies “40,”, then the strobe flashes ON for 4/10ths of a second and then turns OFF for 6/10ths of a second.</summary>
[JsonPropertyName("duty_cycle")]
public long? DutyCycle { get; init; }
///<summary>Indicates the intensity of the strobe as shown in Table 8-23 of the ZCL spec. This attribute is designed to vary the output of the strobe (i.e., brightness) and not its frequency, which is detailed in section 8.4.2.3.1.6 of the ZCL spec.</summary>
[JsonPropertyName("intensity")]
public double? Intensity { get; init; }
}
public partial class ZoneServices
{
private readonly IHaContext _haContext;

View file

@ -11,6 +11,9 @@ namespace NetDaemonConfig.Apps.Frontend.BathroomLight
[NetDaemonApp]
public class BathroomLight
{
// The range of the brightness is 0 to 254
private const double CONV_RATE = 2.54;
private LightEntity? Entity { get; set; }
private InputTextEntity? BrightnessInput { get; set; }
@ -20,7 +23,7 @@ namespace NetDaemonConfig.Apps.Frontend.BathroomLight
if (currentBrightness is not null)
{
double currentBrightnessPercent = Math.Floor((double)currentBrightness / 2.54);
double currentBrightnessPercent = Math.Floor((double)currentBrightness / CONV_RATE);
double inputBrightnessPercent = double.Parse(this.BrightnessInput?.State ?? "0");
if (currentBrightnessPercent != inputBrightnessPercent)
@ -32,19 +35,19 @@ namespace NetDaemonConfig.Apps.Frontend.BathroomLight
public BathroomLight(Services services, Entities entities)
{
// ZigBee needs restart to access Light
entities.Button.Slzb06p7CoreRestart.Press();
this.Entity = entities.Light.Bathroomceiling;
this.Entity = entities.Light.Tz3210KatchgxyTs0505bLight;
this.BrightnessInput = entities.InputText.BathroomLightBrightness;
// Brightness
this.BrightnessInput
.StateAllChanges()
.Subscribe((_) =>
this.BrightnessCallback((_, input) =>
services.Light.TurnOn(
target: ServiceTarget.FromEntity("light.tz3210_katchgxy_ts0505b_light"),
brightness: Math.Floor(input * 2.54 + 1))));
target: ServiceTarget.FromEntity(this.Entity.EntityId),
brightness: Math.Floor(input * CONV_RATE + 1))));
this.Entity
.StateAllChanges()

View file

@ -1,6 +1,4 @@
{...}: let
zigbeeUser = "moskit";
in {
{...}: {
services = {
home-assistant = {
extraComponents = [
@ -14,12 +12,11 @@ in {
enable = true;
listeners = [
{
acl = ["topic readwrite #"];
port = 1883;
acl = ["pattern readwrite #"];
omitPasswordAuth = true;
settings.allow_anonymous = true;
users."${zigbeeUser}".acl = ["readwrite #"];
}
];
};
@ -34,10 +31,9 @@ in {
disable_led = false;
};
mqtt = {
server = "mqtt://localhost/1883";
user = zigbeeUser;
};
mqtt.server = "mqtt://localhost/1883";
availability.enabled = true;
frontend = {
port = 8080;