Refactor ConfigurationDefaults

Making use of the global localization functions, ConfigurationDefaults
is now a constant value instead of a function.
This commit is contained in:
DigiLive
2025-04-23 07:32:16 +02:00
parent e94ce9c830
commit d224fc353c

View File

@@ -1,130 +1,137 @@
import {generic} from "./types/strategy/generic"; import { StrategyDefaults } from './types/strategy/strategy-generics';
import StrategyDefaults = generic.StrategyDefaults; import { localize } from './utilities/localize';
/** /**
* Default configuration for the mushroom strategy. * Default configuration for the mushroom strategy.
*/ */
export const getConfigurationDefaults = (localize: Function): StrategyDefaults => { export const ConfigurationDefaults: StrategyDefaults = {
return {
areas: { areas: {
undisclosed: { undisclosed: {
// TODO: Refactor undisclosed to other.
aliases: [], aliases: [],
area_id: "undisclosed", area_id: 'undisclosed',
created_at: 0, created_at: 0,
floor_id: null, floor_id: null,
hidden: false, hidden: false,
humidity_entity_id: null, humidity_entity_id: null,
icon: "mdi:floor-plan", icon: 'mdi:floor-plan',
labels: [], labels: [],
modified_at: 0, modified_at: 0,
name: "Undisclosed", name: localize('generic.undisclosed'),
picture: null, picture: null,
temperature_entity_id: null, temperature_entity_id: null,
} },
}, },
card_options: {}, card_options: {},
chips: {}, chips: {
climate_count: true,
cover_count: true,
extra_chips: [],
fan_count: true,
light_count: true,
switch_count: true,
weather_entity: 'auto', // TODO: Update Wiki
},
debug: false, debug: false,
domains: { domains: {
_: { _: {
hide_config_entities: true, hide_config_entities: undefined,
hide_diagnostic_entities: true, hide_diagnostic_entities: undefined,
}, },
binary_sensor: { binary_sensor: {
title: `${localize("sensor.binary")} ` + localize("sensor.sensors"), title: `${localize('sensor.binary')} ` + localize('sensor.sensors'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
camera: { camera: {
title: localize("camera.cameras"), title: localize('camera.cameras'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
climate: { climate: {
title: localize("climate.climates"), title: localize('climate.climates'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
cover: { cover: {
title: localize("cover.covers"), title: localize('cover.covers'),
showControls: true, showControls: true,
iconOn: "mdi:arrow-up", iconOn: 'mdi:arrow-up',
iconOff: "mdi:arrow-down", iconOff: 'mdi:arrow-down',
onService: "cover.open_cover", onService: 'cover.open_cover',
offService: "cover.close_cover", offService: 'cover.close_cover',
hidden: false, hidden: false,
}, },
default: { default: {
title: localize("generic.miscellaneous"), title: localize('generic.miscellaneous'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
fan: { fan: {
title: localize("fan.fans"), title: localize('fan.fans'),
showControls: true, showControls: true,
iconOn: "mdi:fan", iconOn: 'mdi:fan',
iconOff: "mdi:fan-off", iconOff: 'mdi:fan-off',
onService: "fan.turn_on", onService: 'fan.turn_on',
offService: "fan.turn_off", offService: 'fan.turn_off',
hidden: false, hidden: false,
}, },
input_select: { input_select: {
title: localize("input_select.input_selects"), title: localize('input_select.input_selects'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
light: { light: {
title: localize("light.lights"), title: localize('light.lights'),
showControls: true, showControls: true,
iconOn: "mdi:lightbulb", iconOn: 'mdi:lightbulb',
iconOff: "mdi:lightbulb-off", iconOff: 'mdi:lightbulb-off',
onService: "light.turn_on", onService: 'light.turn_on',
offService: "light.turn_off", offService: 'light.turn_off',
hidden: false, hidden: false,
}, },
lock: { lock: {
title: localize("lock.locks"), title: localize('lock.locks'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
media_player: { media_player: {
title: localize("media_player.media_players"), title: localize('media_player.media_players'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
number: { number: {
title: localize("generic.numbers"), title: localize('generic.numbers'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
scene: { scene: {
title: localize("scene.scenes"), title: localize('scene.scenes'),
showControls: false, showControls: false,
onService: "scene.turn_on", onService: 'scene.turn_on',
hidden: false, hidden: false,
}, },
select: { select: {
title: localize("select.selects"), title: localize('select.selects'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
sensor: { sensor: {
title: localize("sensor.sensors"), title: localize('sensor.sensors'),
showControls: false, showControls: false,
hidden: false, hidden: false,
}, },
switch: { switch: {
title: localize("switch.switches"), title: localize('switch.switches'),
showControls: true, showControls: true,
iconOn: "mdi:power-plug", iconOn: 'mdi:power-plug',
iconOff: "mdi:power-plug-off", iconOff: 'mdi:power-plug-off',
onService: "switch.turn_on", onService: 'switch.turn_on',
offService: "switch.turn_off", offService: 'switch.turn_off',
hidden: false, hidden: false,
}, },
vacuum: { vacuum: {
title: localize("vacuum.vacuums"), title: localize('vacuum.vacuums'),
showControls: true, showControls: true,
hidden: false, hidden: false,
}, },
@@ -172,6 +179,5 @@ export const getConfigurationDefaults = (localize: Function): StrategyDefaults =
hidden: false, hidden: false,
}, },
}, },
quick_access_cards: [] quick_access_cards: [],
};
}; };