@riddix/hamh 2.1.0-alpha.607 → 2.1.0-alpha.608
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/cli.js
CHANGED
|
@@ -174478,14 +174478,20 @@ function getSelectOptions(entity) {
|
|
|
174478
174478
|
const attrs = entity.state.attributes;
|
|
174479
174479
|
return attrs.options ?? [];
|
|
174480
174480
|
}
|
|
174481
|
-
|
|
174482
|
-
|
|
174483
|
-
|
|
174484
|
-
|
|
174485
|
-
|
|
174486
|
-
|
|
174487
|
-
|
|
174488
|
-
})
|
|
174481
|
+
function buildSelectModeServer(action) {
|
|
174482
|
+
return ModeSelectServer2({
|
|
174483
|
+
getOptions: getSelectOptions,
|
|
174484
|
+
getCurrentOption: (entity) => entity.state.state ?? void 0,
|
|
174485
|
+
selectOption: (option) => ({
|
|
174486
|
+
action,
|
|
174487
|
+
data: { option }
|
|
174488
|
+
})
|
|
174489
|
+
});
|
|
174490
|
+
}
|
|
174491
|
+
var SelectModeServer = buildSelectModeServer("select.select_option");
|
|
174492
|
+
var InputSelectModeServer = buildSelectModeServer(
|
|
174493
|
+
"input_select.select_option"
|
|
174494
|
+
);
|
|
174489
174495
|
function buildSupportedModes(options) {
|
|
174490
174496
|
return options.map((label, index) => ({
|
|
174491
174497
|
label: label.length > 64 ? label.substring(0, 64) : label,
|
|
@@ -174499,6 +174505,12 @@ var SelectEndpointType = ModeSelectDevice.with(
|
|
|
174499
174505
|
HomeAssistantEntityBehavior,
|
|
174500
174506
|
SelectModeServer
|
|
174501
174507
|
);
|
|
174508
|
+
var InputSelectEndpointType = ModeSelectDevice.with(
|
|
174509
|
+
BasicInformationServer2,
|
|
174510
|
+
IdentifyServer2,
|
|
174511
|
+
HomeAssistantEntityBehavior,
|
|
174512
|
+
InputSelectModeServer
|
|
174513
|
+
);
|
|
174502
174514
|
function SelectDevice(homeAssistantEntity) {
|
|
174503
174515
|
const attrs = homeAssistantEntity.entity.state.attributes;
|
|
174504
174516
|
const options = attrs.options ?? [];
|
|
@@ -174524,7 +174536,7 @@ function InputSelectDevice(homeAssistantEntity) {
|
|
|
174524
174536
|
}
|
|
174525
174537
|
const currentOption = homeAssistantEntity.entity.state.state;
|
|
174526
174538
|
const currentIndex = currentOption ? options.findIndex((o) => o.toLowerCase() === currentOption.toLowerCase()) : 0;
|
|
174527
|
-
return
|
|
174539
|
+
return InputSelectEndpointType.set({
|
|
174528
174540
|
homeAssistantEntity,
|
|
174529
174541
|
modeSelect: {
|
|
174530
174542
|
description: homeAssistantEntity.customName ?? homeAssistantEntity.entity.state.attributes.friendly_name ?? "Input Select",
|