handling missing ids better + more tranlsations

This commit is contained in:
ari committed 2022-09-01 17:21:00 -04:00
1 parent 69a9805c02
commit 774ebe482a
45 files changed
+556 -262

No files matched your search

+4
View File
@@ -29,11 +29,15 @@ def make_automation_router(hass_config: HassConfig) -> APIRouter:
@router.post("/item")
def insert_auto(body: Automation):
if body.id is None:
raise HTTPException(status_code=400, detail={"msg": "must contain an id"})
automations = AutomationManager(hass_config)
automations.create(body)
@router.put("/item")
def update_auto(body: ExtenededAutomation):
if body.id is None:
raise HTTPException(status_code=400, detail={"msg": "must contain an id"})
automations = AutomationManager(hass_config)
automations.update(body)
+6 -2
View File
@@ -11,14 +11,18 @@ logger = get_logger(__file__)
class AutomationDBConnection:
def __init__(self) -> None:
self.db: dict[str, ExtenededAutomation] = {}
self.missing_id_db: list[ExtenededAutomation] = []
def reset(self):
self.db = {}
self.missing_id_db = []
def insert_automations(self, automations: list[ExtenededAutomation]):
repeated_automations = []
for automation in automations:
if self.db.get(automation.id, None) is None:
if automation.id is None:
self.missing_id_db.append(automation)
elif self.db.get(automation.id, None) is None:
self.db[automation.id] = automation
else:
repeated_automations.append(
@@ -33,7 +37,7 @@ class AutomationDBConnection:
raise DBNoAutomationFound(automation_id)
def list_automations(self, offset: int, limit: int) -> Iterable[ExtenededAutomation]:
for i, auto in enumerate(self.db.values()):
for i, auto in enumerate([*self.missing_id_db, *self.db.values()]):
if i >= offset and i < limit + offset:
yield auto
+12 -6
View File
@@ -236,9 +236,11 @@ def load_automation_inline_ref(
) -> Iterator[ExtenededAutomation]:
for auto in inline_automation.automations:
try:
cleaned_automation = clean_automation(auto)
automation_id = cleaned_automation.get("id", None)
yield ExtenededAutomation(
**clean_automation(auto),
tags=tag_manager.get(auto["id"], {}),
**cleaned_automation,
tags={} if automation_id is None else tag_manager.get(automation_id, {}),
configuration_key=inline_automation.configuration_key,
source_file=str(inline_automation.source_file.resolve().relative_to(root_path)),
source_file_type="inline",
@@ -286,9 +288,11 @@ def load_automation_path(
if isinstance(automations, dict):
try:
cleaned_automation = clean_automation(automations)
automation_id = cleaned_automation.get("id", None)
yield ExtenededAutomation(
**clean_automation(automations),
tags=tag_manager.get(automations["id"], {}),
**cleaned_automation,
tags={} if automation_id is None else tag_manager.get(automation_id, {}),
configuration_key=configuration_key,
source_file=str(automation_path.resolve().relative_to(root_path)),
source_file_type="obj",
@@ -305,9 +309,11 @@ def load_automation_path(
return
for automation in automations:
try:
cleaned_automation = clean_automation(automation)
automation_id = cleaned_automation.get("id", None)
yield ExtenededAutomation(
**clean_automation(automation),
tags=tag_manager.get(automation["id"], {}),
**cleaned_automation,
tags={} if automation_id is None else tag_manager.get(automation_id, {}),
configuration_key=configuration_key,
source_file=str(automation_path.resolve().relative_to(root_path)),
source_file_type="list",
+1 -1
View File
@@ -32,7 +32,7 @@ AutomationExtractedIter = Iterator[ExtractedAutomation]
class BaseAutomation(BaseModel):
id: str
id: Optional[str]
alias: Optional[str] = None
description: Optional[str] = None
trigger_variables: Optional[dict[str, Union[str, int, bool, float]]] = None
@@ -0,0 +1,21 @@
- alias: UI 1
description: Example
mode: single
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.up_times
- alias: UI 2
description: ""
trigger:
- platform: sun
event: sunrise
offset: 0
condition: []
action: []
mode: single
@@ -0,0 +1,30 @@
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
# automation manual: !include_dir_list ./automations/include_dir_list
# automation ui: !include automations/ui.yaml
# automation: !include automations/base.yaml
# automation cools: !include_dir_merge_list automations/include_dir_merge_list
script: !include scripts.yaml
scene: !include scenes.yaml
automation:
- alias: inline-auto
description: Example package auto
mode: single
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.up_times
homeassistant:
packages: !include packages.yaml
+16
View File
@@ -0,0 +1,16 @@
ha: !include packages/ha.yaml
sub: !include_dir_merge_named packages/sub
secret_ones:
automation:
- alias: package ha
description: Example package auto
mode: single
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.up_times
@@ -0,0 +1 @@
automation: !include ../automations/ui.yaml
@@ -0,0 +1,13 @@
automation:
- alias: package ha
description: Example package auto
mode: single
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.up_times
@@ -10,6 +10,7 @@ from src.automations.tags import TagManager
from src.automations.types import ExtenededAutomation
from src.hass_config.loader import HassConfig
from tests.utils import (
HA_CONFIG13_EXAMPLE,
HA_CONFIG2_EXAMPLE,
HA_CONFIG3_EXAMPLE,
HA_CONFIG4_EXAMPLE,
@@ -160,6 +161,7 @@ class loader_tests(TestCase):
(HA_CONFIG10_EXAMPLE, 3),
(HA_CONFIG11_EXAMPLE, 3),
(HA_CONFIG12_EXAMPLE, 4),
(HA_CONFIG13_EXAMPLE, 4),
]:
with self.subTest(config_name=ha_path.name, expected=expected):
hass_config = HassConfig(ha_path)
+1
View File
@@ -22,6 +22,7 @@ HA_CONFIG9_EXAMPLE = SAMPLES_FOLDER / "config-9"
HA_CONFIG10_EXAMPLE = SAMPLES_FOLDER / "config-10"
HA_CONFIG11_EXAMPLE = SAMPLES_FOLDER / "config-11"
HA_CONFIG12_EXAMPLE = SAMPLES_FOLDER / "config-12"
HA_CONFIG13_EXAMPLE = SAMPLES_FOLDER / "config-13"
def get_example_automation_loader(
+1 -1
View File
@@ -76,7 +76,7 @@ test("update tags from mock api", async () => {
);
let data = ((await mockApi.list({ limit: 10, offset: 0 })) as any).data
.data as AutomationData[];
const autoId = data[0].id;
const autoId = data[0].id as string;
expect(data[0].tags).toStrictEqual({});
mockApi.updateTags({
automation_id: autoId,
@@ -14,7 +14,7 @@ const { componentMeta, make } = makeStory({
}) => {
const [[metadata, tags], setState] = useState([args.metadata, args.tags]);
const tagDB = useTagDB(
[{ id: metadata.id, tags: Object.fromEntries(tags) }],
metadata.id ? [{ id: metadata.id, tags: Object.fromEntries(tags) }] : [],
(_, t) => setState([metadata, Object.entries(t)])
);
@@ -104,7 +104,7 @@ export const AutoInfoBox: FC<AutoInfoBoxProps> = ({
<div className="automation-editor--info-box-inner">
<InputText
label={langStore.get("ID")}
value={metadata.id}
value={metadata.id ?? langStore.get("N/A")}
onChange={onUpdateMetadata("id")}
/>
<InputText
@@ -125,7 +125,7 @@ export const AutoInfoBox: FC<AutoInfoBoxProps> = ({
options={["parallel", "single", "queued", "restart"]}
/>
<div className="automation-editor--info-box--tags">
<h1>Tags</h1>
<h1>{langStore.get("TAGS")}</h1>
<div className="automation-editor--info-box--tag-list">
{tags.map(([tagName, tagValue], tagIndex) => (
<div key={tagIndex} className="automation-editor--info-box--tag">
@@ -19,7 +19,7 @@ const { make, componentMeta } = makeStory({
<AutomationEditor
{...args}
tagDB={useTagDB(
state ? [{ id: state.id, tags: state.tags }] : [],
state && state.id ? [{ id: state.id, tags: state.tags }] : [],
() => {}
)}
automation={state}
@@ -32,6 +32,8 @@ import { MiniFailure } from "types/validators/helper";
import { AutoInfoBox } from "./AutoInfoBox";
import { useAutomatioEditorState, EditorData } from "./state";
import { useLang } from "lang";
import { useSnackbar } from "notistack";
import { Alert } from "@mui/material";
interface Props {
automation?: AutomationData | BareAutomationData;
@@ -41,6 +43,8 @@ interface Props {
onDelete: () => void;
tagDB: TagDB;
isNew?: boolean;
readonly: boolean;
issue?: string;
}
export const AutomationEditor: FC<Props> = ({
dims,
@@ -49,10 +53,12 @@ export const AutomationEditor: FC<Props> = ({
onDelete,
onTrigger,
tagDB,
isNew,
readonly,
issue,
}) => {
// state
const langStore = useLang();
const snackbr = useSnackbar();
const {
state,
updateSequence,
@@ -63,7 +69,15 @@ export const AutomationEditor: FC<Props> = ({
save,
saveAndUpdate,
undo,
} = useAutomatioEditorState(propsAutos, propsOnUpdate);
} = useAutomatioEditorState(propsAutos, (auto) => {
if (readonly) {
snackbr.enqueueSnackbar(langStore.get("READONLY_CANNOT_UPDATE"), {
color: "warning",
});
} else {
propsOnUpdate(auto);
}
});
const [infoBoxOpen, setInfoBox] = useState(false);
const [
{ ckFlipped },
@@ -95,7 +109,13 @@ export const AutomationEditor: FC<Props> = ({
);
}
return (
<div className={["automation-editor", state.status].join(" ")}>
<div
className={[
"automation-editor",
state.status,
readonly ? "readonly" : "",
].join(" ")}
>
{state.status === "saving" && (
<LinearProgress className="linear-loader" />
)}
@@ -112,13 +132,15 @@ export const AutomationEditor: FC<Props> = ({
state.status,
].join(" ")}
>
<Button onClick={() => setInfoBox(false)}>Close</Button>
<Button onClick={() => setInfoBox(false)}>
{langStore.get("CLOSE")}
</Button>
<Button
className={"automation-editor--flow-wrapper--toolbar--save-btn"}
onClick={save}
disabled={state.status !== "changed"}
disabled={state.status !== "changed" || readonly}
>
Save <CheckMarkIcon color="#bf4" />
{langStore.get("SAVE")} <CheckMarkIcon color="#bf4" />
</Button>
</div>
</AutoInfoBox>
@@ -220,6 +242,11 @@ export const AutomationEditor: FC<Props> = ({
{langStore.get("SAVE")} <CheckMarkIcon color="#bf4" />
</Button>
</div>
{readonly && (
<Alert color="warning">
{langStore.get("READONLY_MODE")} - {issue}
</Alert>
)}
<DAGAutomationGraph
action={state.data.action}
trigger={state.data.trigger}
@@ -306,16 +333,14 @@ export const ValidationBox: FC<{
<div className="automation-editor-failures">
<ul>
{failures.map((f, i) => (
<>
<li key={i}>
<b>{f.path}</b>:
<ul>
{f.message.map((m, j) => (
<li key={j}>{m}</li>
))}
</ul>
</li>
</>
<li key={i}>
<b>{f.path}</b>:
<ul>
{f.message.map((m, j) => (
<li key={j}>{m}</li>
))}
</ul>
</li>
))}
</ul>
<span>{langStore.get("VALIDATION_PLEASE_CORRECT_FILE")}</span>
@@ -23,6 +23,7 @@ const { make, componentMeta } = makeStory({
id: "1",
title: "Example",
entityId: "automation.1",
readonly: false,
description: "Amazing automation!",
tags: {},
state: "on",
@@ -38,6 +39,7 @@ const { make, componentMeta } = makeStory({
id: "2",
title: "Example 2",
entityId: "automation.2",
readonly: false,
description: "Cool!",
state: "on",
source_file: "automation.yaml",
@@ -89,6 +91,7 @@ export const Nested = make({
entityId: "automation.1",
description: "",
title: "Automation #1",
readonly: false,
state: "on",
source_file: "automation.yaml",
source_file_type: "list",
@@ -102,6 +105,7 @@ export const Nested = make({
{
id: "2",
entityId: "automation.2",
readonly: false,
description: "another one",
title: "Automation #2",
state: "off",
@@ -117,6 +121,7 @@ export const Nested = make({
{
id: "3",
entityId: "automation.3",
readonly: false,
description: "bad one",
title: "Automation #3",
state: "offing",
@@ -153,6 +158,7 @@ export const Nested = make({
},
data: [
{
readonly: false,
id: "4",
entityId: "automation.4",
description: "Cool thing",
@@ -52,6 +52,7 @@ export const useAutomationDB = (
const auto = defaultAutomation(String(Date.now()));
setNewAuto([
{
readonly: false,
id: auto.id,
entityId: "",
title: auto.alias ?? "",
@@ -77,13 +78,18 @@ const genMapping = (
tagsDB: TagDB,
langStore: LangStore
) => {
const configData: Record<string, AutomationData> = configAutomations.reduce(
(all, n) => ({
...all,
[n.id]: n,
}),
{}
);
const configDataNoId: AutomationData[] = [];
const configData: Record<string, AutomationData & { id: string }> =
configAutomations.reduce((all, n) => {
if (n.id) {
return {
...all,
[n.id]: n,
};
}
configDataNoId.push(n);
return all;
}, {});
const automatioinMap: Record<
string,
[AutomationManagerAuto, AutomationData | null]
@@ -91,7 +97,7 @@ const genMapping = (
Object.entries(haEntities)
.filter(([entityId, _]) => entityId.toLowerCase().startsWith("automation."))
.forEach(([entityId, entityData], i) => {
const autoId = entityData.attributes.id ?? `${entityData.state}-${i}`;
const autoId = entityData.attributes.id ?? entityId.split(".")[1];
let title = entityData.attributes.friendly_name ?? "";
let description = "";
let issue: string | undefined = ["on", "off"].includes(entityData.state)
@@ -127,12 +133,13 @@ const genMapping = (
source_file_type,
configuration_key,
issue,
readonly: found == null,
},
found,
];
});
Object.values(configData).forEach((auto) => {
Object.values(configData).forEach((auto, i) => {
automatioinMap[auto.id] = [
{
id: auto.id,
@@ -145,10 +152,55 @@ const genMapping = (
source_file_type: auto.source_file_type,
configuration_key: auto.configuration_key,
issue: langStore.get("ISSUES_NO_LOAD_AUTOMATION"),
readonly: false,
},
auto,
];
});
let failedGeneration: number = 0;
configDataNoId.forEach((auto) => {
let generatedAutoId = `automation_${failedGeneration + 1}`;
if (auto.alias) {
generatedAutoId = auto.alias
.toLowerCase()
.replaceAll(/\W/g, " ")
.trim()
.replaceAll(" ", "_");
} else {
failedGeneration += 1;
}
if (automatioinMap[generatedAutoId]) {
automatioinMap[generatedAutoId] = [
{
...automatioinMap[generatedAutoId][0],
issue: langStore.get("ISSUE_MUST_CONTAIN_A_UNQIUE_ID_TO_EDIT", {
sourceFile: auto.source_file,
}),
readonly: true,
},
auto,
];
} else {
automatioinMap[generatedAutoId] = [
{
id: generatedAutoId,
entityId: "",
title: auto.alias ?? "",
description: auto.description ?? "",
state: langStore.get("AUTOMATION_STATE_UNREGISTERED"),
tags: {},
source_file: auto.source_file,
source_file_type: auto.source_file_type,
configuration_key: auto.configuration_key,
issue: langStore.get("ISSUE_MUST_CONTAIN_A_UNQIUE_ID_TO_EDIT", {
sourceFile: auto.source_file,
}),
readonly: true,
},
auto,
];
}
});
return automatioinMap;
};
@@ -50,6 +50,8 @@ export const AutomationManagerLoaded: FC<
{state.currentAutomationId !== null ? (
state.currentAutomation ? (
<AutomationEditor
readonly={state.currentAutomationIsReadOnly}
issue={state.currentAutomationIssue}
dims={{
...DEFAULT_DIMS,
flipped: true,
@@ -37,7 +37,11 @@ export const useAutomationManagerState = ({
.map(({ id, tags = {} }) => ({
id,
tags,
})),
}))
.filter(({ id }) => typeof id === "string") as Array<{
id: string;
tags: Record<string, string>;
}>,
onUpdateTags
);
const automationDB = useAutomationDB(hassEntities, configAutomations, tagsDB);
@@ -78,6 +82,14 @@ export const useAutomationManagerState = ({
get currentAutomationEntityId(): string | null {
return currentAutomation === null ? null : currentAutomation[0].entityId;
},
get currentAutomationIsReadOnly(): boolean {
return currentAutomation === null ? true : currentAutomation[0].readonly;
},
get currentAutomationIssue(): string | undefined {
return currentAutomation === null
? undefined
: currentAutomation[0].issue;
},
async setSelectedAutomationId(i: string | null, force: boolean = false) {
if (methods.currentAutomationIsNew && !force) {
if (!(await stillHaveNewAreYouSure())) {
@@ -94,7 +106,9 @@ export const useAutomationManagerState = ({
}
}
const auto = automationDB.addNew();
methods.setSelectedAutomationId(auto.id, true);
if (auto.id) {
methods.setSelectedAutomationId(auto.id, true);
}
},
editorUpdateAutomation(auto: AutomationData | BareAutomationData) {
if (methods.currentAutomationIsNew) {
@@ -71,6 +71,7 @@ const story = makeStory({
source_file: "automation.yaml",
source_file_type: "list",
configuration_key: ["automation"],
readonly: false,
},
]);
setSelAutoId(id);
@@ -100,6 +101,7 @@ const makeAuto = (
source_file: "automation.yaml",
source_file_type: "list",
configuration_key: ["automation"],
readonly: false,
...data,
};
};
@@ -38,10 +38,11 @@ const automations: AutomationManagerAuto[] = [
description: a.description ?? "",
state: "on",
tags: a.tags,
id: a.id,
id: a.id as string,
isSelected: false,
source_file: "automation.yaml",
source_file_type: "list",
readonly: false,
configuration_key: ["automation"],
}));
@@ -51,7 +52,8 @@ const bigList = bigMockAutoList.map<AutomationManagerAuto>((a) => ({
description: a.description ?? "",
state: "on",
tags: a.tags,
id: a.id,
id: a.id as string,
readonly: false,
isSelected: false,
source_file: "automation.yaml",
source_file_type: "list",
@@ -12,6 +12,7 @@ export type AutomationManagerAuto = AutomationManagerAutoUpdatable & {
source_file: string;
source_file_type: string;
configuration_key: string[];
readonly: boolean;
};
export type AutomationManagerAutoItem = AutomationManagerAuto & {
flags: AutomationManagerItemFlags;
@@ -271,7 +271,7 @@ export const StateEditor: Editor<StateCondition> = ({
}
/>
<InputTime
label="For"
label={langStore.get("FOR")}
value={condition.for}
onChange={(_for) =>
onChange({
@@ -4,6 +4,7 @@ import {
InputAutoCompletePropsBase,
} from "./InputAutoComplete";
import { useHAAreas } from "haService/AreaRegistry";
import { useLang } from "lang";
export type InputAreaProps = InputAutoCompletePropsBase & {
restrictToDomain?: string[];
@@ -11,12 +12,13 @@ export type InputAreaProps = InputAutoCompletePropsBase & {
};
export const InputArea: FC<InputAreaProps> = (props) => {
const lang = useLang();
// state
const areas = useHAAreas();
return (
<InputAutoComplete
{...props}
label={props.label ?? "Area"}
label={props.label ?? lang.get("AREA")}
getID={areas.getID}
getLabel={areas.getLabel}
options={areas.getOptions()}
@@ -7,6 +7,7 @@ import Popper from "@mui/material/Popper";
import { SearchItem } from "./extras";
import { ReactNode } from "react";
import { prettyName } from "utils/formatting";
import { useLang } from "lang";
export type BaseOption<T = {}> = {
id: string;
@@ -65,6 +66,7 @@ export function computeSimilarity(
export function InputAutoComplete<T extends Option>(
props: InputAutoCompleteProps<T>
) {
const lang = useLang();
// aliases
const getID = (opt: T): string => {
if (props.getID) {
@@ -212,7 +214,7 @@ export function InputAutoComplete<T extends Option>(
}}
variant="filled"
required={props.required}
label={props.label ?? "Entity ID"}
label={props.label ?? lang.get("ENTITY_ID")}
helperText={helperText}
disabled={props.disabled}
error={error}
@@ -1,5 +1,6 @@
import { FC } from "react";
import { useHADeviceRegistry } from "haService";
import { useLang } from "lang";
import {
InputAutoComplete,
InputAutoCompletePropsBase,
@@ -9,11 +10,12 @@ export type InputDeviceProps = InputAutoCompletePropsBase;
export const InputDevice: FC<InputDeviceProps> = (props) => {
// state
const lang = useLang();
const dr = useHADeviceRegistry();
return (
<InputAutoComplete
{...props}
label={props.label ?? "Device"}
label={props.label ?? lang.get("DEVICE")}
getID={dr.getID}
getLabel={dr.getLabel}
options={dr.getOptions()}
@@ -1,19 +1,27 @@
import { FC } from "react";
import { useHAServices } from 'haService';
import { InputAutoComplete, InputAutoCompletePropsBase } from './InputAutoComplete';
import { prettyName } from 'utils/formatting';
import { useHAServices } from "haService";
import {
InputAutoComplete,
InputAutoCompletePropsBase,
} from "./InputAutoComplete";
import { prettyName } from "utils/formatting";
import { useLang } from "lang";
export type InputServiceProps = InputAutoCompletePropsBase & { multiple?: false };
export type InputServiceProps = InputAutoCompletePropsBase & {
multiple?: false;
};
export const InputService: FC<InputServiceProps> = props => {
const services = useHAServices();
return <InputAutoComplete
{...props}
label={props.label ?? "Service"}
options={services.getOptions()}
getID={services.getID}
getLabel={services.getLabel}
groupBy={opt => (typeof opt !== 'string') ? prettyName(opt.domain) : ''}
export const InputService: FC<InputServiceProps> = (props) => {
const services = useHAServices();
const lang = useLang();
return (
<InputAutoComplete
{...props}
label={props.label ?? lang.get("SERVICE")}
options={services.getOptions()}
getID={services.getID}
getLabel={services.getLabel}
groupBy={(opt) => (typeof opt !== "string" ? prettyName(opt.domain) : "")}
/>
}
);
};
@@ -12,6 +12,7 @@ import {
} from "utils/time";
import { InputEntity } from "./InputEntities";
import { InputTime } from "components/Inputs/Base/InputTime";
import { useLang } from "lang";
export type InputTimeEntityProps = {
value: string;
@@ -23,6 +24,7 @@ export const InputTimeEntity: FC<InputTimeEntityProps> = ({
onChange,
className = "",
}) => {
const lang = useLang();
const is24Hour = isAutomationTimeString24Hours(value);
let editor: ReactNode;
if (is24Hour) {
@@ -39,7 +41,7 @@ export const InputTimeEntity: FC<InputTimeEntityProps> = ({
} else {
editor = (
<InputEntity
label="Time Entity"
label={lang.get("TIME_ENTITY")}
restrictMode="or"
restrictedDeviceClass={["timestamp"]}
restrictToDomain={["input_datetime"]}
+22 -15
View File
@@ -12,6 +12,7 @@ import {
} from "utils/time";
import { prettyName } from "utils/formatting";
import { ButtonIcon } from "components/Icons/ButtonIcons";
import { useLang } from "lang";
// constants
const fields: Array<keyof AutomationTimeObject> = [
@@ -29,6 +30,7 @@ export type InputTimeProps = {
};
export const InputTime: FC<InputTimeProps> = (props) => {
// state
const lang = useLang();
const [disabled, setDisabled] = useState(!props.value);
const [displayValue, setDisplayValue] = useState(
convertAutomationTimeToTimeObject(props.value)
@@ -127,21 +129,26 @@ export const InputTime: FC<InputTimeProps> = (props) => {
<div className={["input-time", props.className ?? ""].join(" ")}>
{/* <InputLabel >{props.label}</InputLabel> */}
<div className="input-time--inner">
{fields.map((name) => (
<TextField
key={name}
variant="filled"
label={prettyName(name)}
defaultValue="00"
InputProps={{
disabled,
type: "number",
title: prettyName(name),
}}
value={displayValue[name] ?? 0}
onChange={(e) => updateOne(name)(e.target.value)}
/>
))}
{fields.map((name) => {
const label = prettyName(
lang.get(`TIME_UNITS_${name}`.toUpperCase())
);
return (
<TextField
key={name}
variant="filled"
label={label}
defaultValue="00"
InputProps={{
disabled,
type: "number",
title: label,
}}
value={displayValue[name] ?? 0}
onChange={(e) => updateOne(name)(e.target.value)}
/>
);
})}
{!props.restrictEmpty && (
<ButtonIcon
onClick={() => setDisabled(!disabled)}
@@ -10,18 +10,18 @@ export const ActionEventState: OptionManager<FireEventAction> = {
event_data: {},
}),
isReady: ({ alias, event }) => alias !== "" && event !== "",
renderOptionList: (state, setState) => {
Component: ({ state, setState, langStore }) => {
const update = updateActionData(state, setState);
return (
<>
<InputText
textBoxFor="event"
label="Event"
label={langStore.get("EVENT")}
value={state.event}
onChange={(event) => update({ event })}
/>
<InputYaml
label="Event Data"
label={langStore.get("EVENT_DATA")}
value={state.event_data}
onChange={(event_data) => update({ event_data })}
/>
@@ -15,12 +15,12 @@ export const ActionRepeatState: OptionManager<RepeatAction> = {
},
}),
isReady: () => true,
Component: ({ state, setState }) => {
Component: ({ state, setState, langStore }) => {
const repeatType = determineType(state.repeat);
return (
<>
<InputAutoComplete
label="Type"
label={langStore.get("TYPE")}
value={repeatType}
options={["while", "until", "count"]}
onChange={(v) => {
@@ -53,7 +53,7 @@ export const ActionRepeatState: OptionManager<RepeatAction> = {
/>
{"count" in state.repeat && (
<InputNumber
label="How many times?"
label={langStore.get("HOW_MANY_TIMES")}
value={state.repeat.count}
onChange={(count = 1) =>
setState({
@@ -7,11 +7,11 @@ export const ActionSceneState: OptionManager<SceneAction> = {
scene: "",
}),
isReady: () => true,
Component: ({ state, setState }) => {
Component: ({ state, setState, langStore }) => {
return (
<>
<InputEntity
label="Scene"
label={langStore.get("SCENE")}
restrictToDomain={["scene"]}
value={state.scene ?? ""}
onChange={(d) => setState({ ...state, scene: d ?? "" })}
@@ -8,11 +8,11 @@ export const ActionStopState: OptionManager<StopAction> = {
stop: "",
}),
isReady: () => true,
Component: ({ state, setState }) => {
Component: ({ state, setState, langStore }) => {
return (
<>
<InputText
label="Stop Reason"
label={langStore.get("STOP_REASON")}
value={state.stop ?? []}
onChange={(d) => setState({ ...state, stop: d })}
/>
@@ -24,7 +24,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
delay: "",
}),
isReady: () => true,
Component: ({ state, setState }) => {
Component: ({ state, setState, langStore }) => {
// state
const update = updateActionData(state, setState);
const [current, _setCurrent] = useState(getCurrentOption(state));
@@ -63,7 +63,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
<>
<InputTime
className="for"
label="for"
label={langStore.get("FOR")}
value={(state as any).delay}
onChange={(delay) => update({ delay })}
/>
@@ -87,7 +87,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
<>
<InputYaml
className="triggers"
label="Triggers"
label={langStore.get("TRIGGERS")}
value={state.wait_for_trigger ?? []}
onChange={(wait_for_trigger) => update({ wait_for_trigger })}
/>
@@ -100,7 +100,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
<div className="node-editor--action-wait">
<InputList
className="wait-type"
label="Wait Type"
label={langStore.get("WAIT_TYPE")}
prettyOptionLabels
options={["template", "trigger", "delay"]}
current={current}
@@ -110,7 +110,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
{current !== "delay" ? (
<div className="wait-options">
<InputNumber
label="Timeout"
label={langStore.get("TIMEOUT")}
value={
(state as any).timeout
? Number((state as any).timeout)
@@ -123,7 +123,7 @@ export const ActionWaitState: OptionManager<ThisAction> = {
}
/>
<InputBoolean
label="Continue on Timeout"
label={langStore.get("CONTINUTE_ON_TIMEOUT")}
value={(state as any).continue_on_timeout ?? false}
onChange={(continue_on_timeout) =>
update({ continue_on_timeout })
@@ -1,5 +1,6 @@
import { HAService } from "haService";
import { HAEntitiesState } from "haService/HAEntities";
import { LangStore } from "lang";
import { FC } from "react";
import { AutomationAction } from "types/automations/actions";
import { AutomationCondition } from "types/automations/conditions";
@@ -21,6 +22,7 @@ export type OptionManager<T> = {
setState: (s: T) => void;
ha: HAService;
createMode: boolean;
langStore: LangStore;
}>;
}
);
@@ -15,6 +15,7 @@ import { Button } from "components/Inputs/Buttons/Button";
import { useState } from "react";
import AddIcon from "@mui/icons-material/Add";
import { InputTimeEntity } from "components/Inputs/AutoComplete/InputTimeEntity";
import { useLang } from "lang";
export const TriggerTime: OptionManager<AutomationTriggerTime> = {
defaultState: () => ({
@@ -115,10 +116,11 @@ export const TriggerTimePattern: FC<{
state: AutomationTriggerTimePattern;
setState: (t: AutomationTriggerTimePattern) => void;
}> = ({ state, setState }) => {
const lang = useLang();
return (
<div className="trigger-time--pattern">
<InputText
label="Hours"
label={lang.get("TIME_UNITS_HOURS")}
value={state.hours ?? ""}
onChange={(hours) =>
setState({
@@ -128,7 +130,7 @@ export const TriggerTimePattern: FC<{
}
/>
<InputText
label="Minutes"
label={lang.get("TIME_UNITS_MINUTES")}
value={state.minutes ?? ""}
onChange={(minutes) =>
setState({
@@ -138,7 +140,7 @@ export const TriggerTimePattern: FC<{
}
/>
<InputText
label="Seconds"
label={lang.get("TIME_UNITS_SECONDS")}
value={state.seconds ?? ""}
onChange={(seconds) =>
setState({
@@ -158,6 +158,7 @@ export const useEditorNodeState = (
setState={setState}
ha={ha}
createMode={createMode}
langStore={langStore}
/>
)}
</>
+1 -1
View File
@@ -134,7 +134,7 @@ export const NodeEditor: FC<NodeEditorProps> = ({
areYouSureNotReady("close", true).then((ok) => ok && onClose())
}
>
Close
{langStore.get("CLOSE")}
</Button>
<Button
className="node-editor--footer--save"
+22 -1
View File
@@ -1,5 +1,6 @@
{
"ADD": "Add",
"AREA": "Area",
"ALIAS": "Alias",
"ATTRIBUTE": "Attribute",
"ABOVE": "Above",
@@ -34,8 +35,10 @@
"OR": "Or",
"ZONE": "Zone",
"ENTITY": "Entity",
"ENTITY_ID": "Entity ID",
"ENABLED": "Enabled",
"ENTITY_WITH_LOCATION": "Entity with Location",
"TIME_ENTITY": "Time Entity",
"AND_MORE": "and more",
"YES": "Yes",
"NO": "No",
@@ -43,16 +46,28 @@
"SERVICE": "Service",
"REPEAT": "Repeat",
"WAIT": "Wait",
"WAIT_TYPE": "Wait Type",
"STOP": "Stop",
"STOP_REASON": "Stop Reason",
"CHOOSE": "Choose",
"PARALLEL": "Parallel",
"SCENE": "Scene",
"TIME_UNITS_HOURS": "hours",
"TIME_UNITS_MINUTES": "minutes",
"TIME_UNITS_SECONDS": "seconds",
"TIME_UNITS_MILISECONDS": "milliseconds",
"TIMEOUT": "Timeout",
"CONTINUTE_ON_TIMEOUT": "Continue on Timeout",
"FOR": "For",
"AND": "and",
"NOT": "not",
"NUMERIC_STATE": "Numeric State",
"TIME": "Time",
"EVENT": "Event",
"EVENT_DATA": "Event Data",
"HOMEASSISTANT": "Home Assistant",
"CALENDAR": "Calendar",
"WEBHOOK": "Webhook",
@@ -109,6 +124,7 @@
"ISSUES_INVALID_STATE": "Recived invalid state '{{state}}', this could be because you have a lingering automation that was not cleared by homeassistant, try to reboot HA or manually clear this automation from HA Database.",
"ISSUES_FIND_AUTOMATION_IN_CONFIG": "failed to find this automation in '/config' folder",
"ISSUES_NO_LOAD_AUTOMATION": "homeassistant did not load this automation, try to manually reload automations or restart homeassistant.",
"ISSUE_MUST_CONTAIN_A_UNQIUE_ID_TO_EDIT": "In order to modify an automation you have specify a unique id. Please go to the file '{{sourceFile}}' and add an `id` field to the automation.",
"AUTOMATION_STATE_UNREGISTERED": "unregistered",
"AUTOMATION_STATE_ON": "On",
@@ -154,5 +170,10 @@
"WARNING_SWITCHING_FROM_NONE_SAVE": "Selecting another automation will cause you to lose all work done on this new automation. Please save your work on this automation first.",
"WARNING_DEVICE_NO_TYPES": "This device has no {{type}}.",
"INFO_SUCCESS_CALL": "Successfully called {{entityId}}"
"INFO_SUCCESS_CALL": "Successfully called {{entityId}}",
"HOW_MANY_TIMES": "How many times?",
"READONLY_MODE": "Read Only Mode",
"READONLY_CANNOT_UPDATE": "Cannot update in readonly mode"
}
+22 -1
View File
@@ -1,5 +1,6 @@
{
"ADD": "Ajouter",
"AREA": "Zone",
"ALIAS": "Alias",
"ATTRIBUTE": "Attribuer",
"ABOVE": "Plus grand que",
@@ -37,8 +38,10 @@
"OR": "Ou",
"ZONE": "Zone",
"ENTITY": "Entité",
"ENTITY_ID": "ID d'entité",
"ENABLED": "Activé",
"ENTITY_WITH_LOCATION": "Entité avec emplacement",
"TIME_ENTITY": "Entité temporelle",
"AND_MORE": "et plus",
"YES": "Oui",
"NO": "Non",
@@ -46,21 +49,33 @@
"SERVICE": "Service",
"REPEAT": "Répéter",
"WAIT": "Attendre",
"WAIT_TYPE": "Type d'attente",
"STOP": "Arrêt",
"STOP_REASON": "Raison d'arrêt",
"CHOOSE": "Choisir",
"PARALLEL": "Parallèle",
"SCENE": "Scène",
"EVENT": "Événement",
"EVENT_DATA": "Données d'événement",
"HOMEASSISTANT": "Home Assistant",
"CALENDAR": "Calendrier",
"WEBHOOK": "Webhook",
"SUN": "Soleil",
"MQTT": "MQTT",
"TIME_UNITS_HOURS": "heures",
"TIME_UNITS_MINUTES": "minutes",
"TIME_UNITS_SECONDS": "secondes",
"TIME_UNITS_MILISECONDS": "millisecondes",
"TIMEOUT": "Temps libre",
"CONTINUTE_ON_TIMEOUT": "Continuer sur Timeout",
"CONNECTED": "Connecté",
"FAILED": "Échoué",
"LOADING": "Chargement",
"FOR": "Pour",
"AND": "et",
"NOT": "non",
"NUMERIC_STATE": "État numérique",
@@ -111,6 +126,7 @@
"ISSUES_INVALID_STATE": "État invalide reçu '{{state}}', cela peut être dû au fait que vous avez une automatisation persistante qui n'a pas été effacée par Home Assistant, essayez de redémarrer Home Assistant ou effacez manuellement cette automatisation de la base de données HA.",
"ISSUES_FIND_AUTOMATION_IN_CONFIG": "impossible de trouver cette automatisation dans le dossier '/config'",
"ISSUES_NO_LOAD_AUTOMATION": "homeassistant n'a pas chargé cette automatisation, essayez de recharger manuellement les automatisations ou redémarrez Home Assistant.",
"ISSUE_MUST_CONTAIN_A_UNQIUE_ID_TO_EDIT": "Pour modifier une automatisation, vous devez spécifier un identifiant unique. Veuillez aller dans le fichier '{{sourceFile}}' et ajouter un champ `id` à l'automatisation.",
"AUTOMATION_STATE_UNREGISTERED": "non enregistré",
"AUTOMATION_STATE_ON": "Activé",
@@ -156,5 +172,10 @@
"WARNING_SWITCHING_FROM_NONE_SAVE": "La sélection d'une autre automatisation vous fera perdre tout le travail effectué sur cette nouvelle automatisation. Veuillez d'abord enregistrer votre travail sur cette automatisation.",
"WARNING_DEVICE_NO_TYPES": "Cet appareil n'a pas de {{type}}.",
"INFO_SUCCESS_CALL": "{{entityId}} a été appelé avec succès"
"INFO_SUCCESS_CALL": "{{entityId}} a été appelé avec succès",
"HOW_MANY_TIMES": "Données d'événementaCombien de fois?",
"READONLY_MODE": "Mode lecture seule",
"READONLY_CANNOT_UPDATE": "Impossible de mettre à jour en mode lecture seule"
}
+178 -158
View File
@@ -1,159 +1,179 @@
{
"ADD": "Aggiungi",
"ALIAS": "Alias",
"ATTRIBUTE": "Attributo",
"ABOVE": "Above",
"BELOW": "Below",
"ID": "Id",
"NAME": "Nome",
"TAG": "Tag",
"TAGS": "Tags",
"DEVICE": "Dispositivo",
"ACTION": "Azione",
"TAG_NAME": "Nome Tag",
"TAG_VALUE": "Valore Tag",
"TITLE": "Titolo",
"TYPE": "Tipo",
"TRIGGER_ID": "ID Attivazione",
"TEMPLATE": "Modello",
"MODE": "Modalità",
"CLOSE": "Chiudi",
"DESCRIPTION": "Descrizione",
"TRIGGER": "Attivazione",
"CONDITION": "Condizione",
"DELETE": "Elimina",
"METADATA": "Metadata",
"UNDO": "Annulla",
"RAW": "Raw",
"SAVE": "Salva",
"STATE": "Stato",
"SEARCH": "Cerca",
"FLIPP": "Flip",
"CANCEL": "Cancella",
"CREATE": "Crea",
"OR": "Oppure",
"ZONE": "Zona",
"ENTITY": "Entità",
"ENABLED": "A",
"ENTITY_WITH_LOCATION": "Entità con posizione",
"AND_MORE": "e altro",
"YES": "Sì",
"NO": "No",
"SERVICE": "Chiama Servizio",
"REPEAT": "Ripeti",
"WAIT": "Attesa",
"STOP": "Ferma",
"CHOOSE": "Scegli",
"PARALLEL": "Eseguire in parallelo",
"SCENE": "Scena",
"AND": "e",
"NOT": "non",
"NUMERIC_STATE": "Valore Numerico",
"TIME": "Ora",
"EVENT": "Evento",
"HOMEASSISTANT": "Home Assistant",
"CALENDAR": "Calendario",
"WEBHOOK": "Webhook",
"SUN": "Sole",
"MQTT": "MQTT",
"CONNECTED": "Connesso",
"FAILED": "Fallito",
"LOADING": "Caricamento",
"DAY_MON": "Lunedì",
"DAY_TUE": "Martedì",
"DAY_WED": "Mercoledì",
"DAY_THU": "Giovedì",
"DAY_FRI": "Venerdì",
"DAY_SAT": "Sabato",
"DAY_SUN": "Domenica",
"WEEKDAY": "Giorno della settimana",
"OPTION": "Opzione",
"THEME": "Tema",
"LANGUAGE": "Lingua",
"USER_PRERENCES": "Impostazioni",
"SELECT_AUTOMATION": "Seleziona automazione",
"TRIGGER_AUTOMATION": "Innesca Automazione",
"DELETE_AUTOMATION": "Elimina automazione",
"CONFIRMATION_DELETE_THIS_AUTOMATION": "Sei sicuro di voler eliminare questa automazione?",
"CONFIRMATION_DELETE_THIS_NODE": "Sei sicuro di voler eliminare questo nodo?",
"DELETED": "Eliminato.",
"NOT_DELETED_NODE": "Il nodo non è stato eliminato.",
"NOT_DELETED_THING": "{{item}} non è stato eliminato.",
"MISSING_TEXT": "TESTO MANCANTE -- {{langId}}",
"AUTOMATION_METADATA_TOOLTIP_TEXT": "Questa automazione si trova nel file {{source_file}}. It's currently '{{state}}', it's entity id is '{{entityId}}' and it's automation id is '{{id}}'",
"AUTOMATION_METADATA_TOOLTIP_SIMPLE": "ID={{id}}, ID Entità={{entityId}}",
"ERROR_FAILED_TO_SAVE": "Salvataggio dell'automazione fallito \"{{aid}}\" contents - {{contents}} -- non trovato in `/config`",
"ERROR_INVALID_AUTOMATION_STATE": "Stato Non Valido",
"ERROR_INVALID_AUTOMATION_DETECTED": "Rilevate Automazioni Non Valide!",
"ERROR_FAILED_CONNECTION_TO_HA": "Connessione al websocket fallita, perfavore controlla che il tuo token di accesso sia impostato correttamente.",
"ERROR_FAILED_CALLING": "Chiamata di {{entityId}} fallita perchè '{{msg}}'",
"ERROR_FAILED_CALLING_BC_CONNECTION": "Chiamata al servizio fallita perchè la connessione è '{{connStatus}}' -- {{connError}}",
"ERROR_INVALID_YAML": "! Yaml non valido !",
"AUTOMATION_STATE_IS": "L'automazione è {{state}}",
"ISSUE_FAILED_TO_FIND_AUTOMATION_ON_DISK": "Rcierca sul disco dell'automazione con id = {{id}} fallita ",
"ISSUES_INVALID_STATE": "Ricevuto uno stato non valido '{{state}}', questo potrebbe essere causato da una automazione persistente che non è stata cancellata da homeassistant, prova a riavviare HA o ad eliminare manualmente questa automazione dal database di HA.",
"ISSUES_FIND_AUTOMATION_IN_CONFIG": "ricerca dell'automazione fallita nella cartella '/config' ",
"ISSUES_NO_LOAD_AUTOMATION": "homeassistant non ha caricato questa automazione, prova a ricaricare manualmente le automazioni o riavvia homeassistant.",
"AUTOMATION_STATE_UNREGISTERED": "Non registrata",
"AUTOMATION_STATE_ON": "On",
"AUTOMATION_STATE_OFF": "Off",
"AUTOMATION_MANAGER_STATE_CHANGE": "cambiando lo stato dell'automazione",
"AUTOMATION_MANAGER_STATE_CHANGE_FAIL": "Failed to toggle automation due to \"{{err}}\"",
"AUTOMATION_MANAGER_REFRESH": "aggiornamento automazioni",
"AUTOMATION_MANAGER_REFRESH_FAIL": "Aggiornamento delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_DELETE": "eliminando l'automazione",
"AUTOMATION_MANAGER_DELETE_FAIL": "Eliminazione fallita a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_TRIGGER": "attivando l'automazione",
"AUTOMATION_MANAGER_TRIGGER_FAIL": "Attivazione fallita a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_ADD": "aggiungendo l'automazione",
"AUTOMATION_MANAGER_ADD_FAIL": "Aggiunta delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_UPDATE": "aggironando l'automazione",
"AUTOMATION_MANAGER_UPDATE_FAIL": "Aggiornamento delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_UPDATE_TAGS": "Aggiornando i tag delle automazioni",
"AUTOMATION_MANAGER_UPDATE_TAGS_FAIL": "Aggiornamento dei tag delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_DELETE_LIGHT": "Eliminazione dell'automazione fallita, potresti risolvere aggiornando o riavviando Home Assistant",
"NEW_AUTOMATION": "Nuova Automazione",
"SWITCH_AUTOMATION": "Cambia Automazione",
"N/A": "n/d",
"VALIDATION_AUTOMATION_NAME": "Il nome deve essere lungo almeno un 1 carattere",
"VALIDATION_MAX_TAG_SELECTION": "Puoi selezionare massimo {{count}} tag",
"VALIDATION_TAG_EXISTS": "Il tag '{{name}}' esiste già",
"VALIDATION_PLEASE_CORRECT_FILE": "Perfavore correggi il file dell'automazione manualmente e poi continua !",
"VALIDATION_MISSING_VALUES_FOR_NODE": "Questo nodo contiene dei valori mancanti",
"VALIDATION_ERROR_VALUES_IN_NODE": "Questo nodo contiene errori",
"VALIDATION_UNSAVED_WORK_IN_NODE": "Questo nodo ha delle modifiche non salvate",
"VALIDATION_NOT_ALL_FIELD_FILLED_IN": "Alcuni campi non sono stati compilati correttamente",
"CONFIRM_EXIT": "Sei sicuro di voler {{what}}?",
"MODE_SIGNLE_LABEL": "Non avviare una nuova esecuzione. Fornisci un avvertimento.",
"MODE_SIGNLE_PARALLEL": "Avvia una nuova e indipendente esecuzione in parallelo con le esecuzioni precedenti.",
"MODE_SIGNLE_QUEUED": "Avvia una nuova esecuzione dopo che tutte le altre sono state completate. Le esecuzioni partiranno nell'ordine in cui sono state accodate.",
"MODE_SIGNLE_RESTART": "Avvia una nuova esecuzione dopo aver fermato quella precedente.",
"WARNING_SWITCHING_FROM_NONE_SAVE": "Selezionando un'altra automazione perderai tutte le modifiche effettuate a questa nuova automazione. Salva prima le modifiche.",
"WARNING_DEVICE_NO_TYPES": "Questo dispositivo non ha {{type}}.",
"INFO_SUCCESS_CALL": "{{entityId}} chiamata con successo"
}
"ADD": "Aggiungi",
"AREA": "La zona",
"ALIAS": "Alias",
"ATTRIBUTE": "Attributo",
"ABOVE": "Above",
"BELOW": "Below",
"ID": "Id",
"NAME": "Nome",
"TAG": "Tag",
"TAGS": "Tags",
"DEVICE": "Dispositivo",
"ACTION": "Azione",
"TAG_NAME": "Nome Tag",
"TAG_VALUE": "Valore Tag",
"TITLE": "Titolo",
"TYPE": "Tipo",
"TRIGGER_ID": "ID Attivazione",
"TEMPLATE": "Modello",
"MODE": "Modalità",
"CLOSE": "Chiudi",
"DESCRIPTION": "Descrizione",
"TRIGGER": "Attivazione",
"CONDITION": "Condizione",
"DELETE": "Elimina",
"METADATA": "Metadata",
"UNDO": "Annulla",
"RAW": "Raw",
"SAVE": "Salva",
"STATE": "Stato",
"SEARCH": "Cerca",
"FLIPP": "Flip",
"CANCEL": "Cancella",
"CREATE": "Crea",
"OR": "Oppure",
"ZONE": "Zona",
"ENTITY": "Entità",
"ENTITY_ID": "ID entità",
"ENABLED": "A",
"ENTITY_WITH_LOCATION": "Entità con posizione",
"TIME_ENTITY": "Entità Tempo",
"AND_MORE": "e altro",
"YES": "Sì",
"NO": "No",
"SERVICE": "Chiama Servizio",
"REPEAT": "Ripeti",
"WAIT": "Attesa",
"WAIT_TYPE": "Tipo di attesa",
"STOP": "Ferma",
"STOP_REASON": "Ferma la ragione",
"CHOOSE": "Scegli",
"PARALLEL": "Eseguire in parallelo",
"SCENE": "Scena",
"TIME_UNITS_HOURS": "ore",
"TIME_UNITS_MINUTES": "minuti",
"TIME_UNITS_SECONDS": "secondi",
"TIME_UNITS_MILISECONDS": "millisecondi",
"TIMEOUT": "Tempo scaduto",
"CONTINUTE_ON_TIMEOUT": "Continua su Timeout",
"FOR": "Per",
"AND": "e",
"NOT": "non",
"NUMERIC_STATE": "Valore Numerico",
"TIME": "Ora",
"EVENT": "Evento",
"EVENT_DATA": "Dati dell'evento",
"HOMEASSISTANT": "Home Assistant",
"CALENDAR": "Calendario",
"WEBHOOK": "Webhook",
"SUN": "Sole",
"MQTT": "MQTT",
"CONNECTED": "Connesso",
"FAILED": "Fallito",
"LOADING": "Caricamento",
"DAY_MON": "Lunedì",
"DAY_TUE": "Martedì",
"DAY_WED": "Mercoledì",
"DAY_THU": "Giovedì",
"DAY_FRI": "Venerdì",
"DAY_SAT": "Sabato",
"DAY_SUN": "Domenica",
"WEEKDAY": "Giorno della settimana",
"OPTION": "Opzione",
"THEME": "Tema",
"LANGUAGE": "Lingua",
"USER_PRERENCES": "Impostazioni",
"SELECT_AUTOMATION": "Seleziona automazione",
"TRIGGER_AUTOMATION": "Innesca Automazione",
"DELETE_AUTOMATION": "Elimina automazione",
"CONFIRMATION_DELETE_THIS_AUTOMATION": "Sei sicuro di voler eliminare questa automazione?",
"CONFIRMATION_DELETE_THIS_NODE": "Sei sicuro di voler eliminare questo nodo?",
"DELETED": "Eliminato.",
"NOT_DELETED_NODE": "Il nodo non è stato eliminato.",
"NOT_DELETED_THING": "{{item}} non è stato eliminato.",
"MISSING_TEXT": "TESTO MANCANTE -- {{langId}}",
"AUTOMATION_METADATA_TOOLTIP_TEXT": "Questa automazione si trova nel file {{source_file}}. It's currently '{{state}}', it's entity id is '{{entityId}}' and it's automation id is '{{id}}'",
"AUTOMATION_METADATA_TOOLTIP_SIMPLE": "ID={{id}}, ID Entità={{entityId}}",
"ERROR_FAILED_TO_SAVE": "Salvataggio dell'automazione fallito \"{{aid}}\" contents - {{contents}} -- non trovato in `/config`",
"ERROR_INVALID_AUTOMATION_STATE": "Stato Non Valido",
"ERROR_INVALID_AUTOMATION_DETECTED": "Rilevate Automazioni Non Valide!",
"ERROR_FAILED_CONNECTION_TO_HA": "Connessione al websocket fallita, perfavore controlla che il tuo token di accesso sia impostato correttamente.",
"ERROR_FAILED_CALLING": "Chiamata di {{entityId}} fallita perchè '{{msg}}'",
"ERROR_FAILED_CALLING_BC_CONNECTION": "Chiamata al servizio fallita perchè la connessione è '{{connStatus}}' -- {{connError}}",
"ERROR_INVALID_YAML": "! Yaml non valido !",
"AUTOMATION_STATE_IS": "L'automazione è {{state}}",
"ISSUE_FAILED_TO_FIND_AUTOMATION_ON_DISK": "Rcierca sul disco dell'automazione con id = {{id}} fallita ",
"ISSUES_INVALID_STATE": "Ricevuto uno stato non valido '{{state}}', questo potrebbe essere causato da una automazione persistente che non è stata cancellata da homeassistant, prova a riavviare HA o ad eliminare manualmente questa automazione dal database di HA.",
"ISSUES_FIND_AUTOMATION_IN_CONFIG": "ricerca dell'automazione fallita nella cartella '/config' ",
"ISSUES_NO_LOAD_AUTOMATION": "homeassistant non ha caricato questa automazione, prova a ricaricare manualmente le automazioni o riavvia homeassistant.",
"ISSUE_MUST_CONTAIN_A_UNQIUE_ID_TO_EDIT": "Per modificare un'automazione è necessario specificare un ID univoco. Vai al file '{{sourceFile}}' e aggiungi un campo `id` all'automazione.",
"AUTOMATION_STATE_UNREGISTERED": "Non registrata",
"AUTOMATION_STATE_ON": "On",
"AUTOMATION_STATE_OFF": "Off",
"AUTOMATION_MANAGER_STATE_CHANGE": "cambiando lo stato dell'automazione",
"AUTOMATION_MANAGER_STATE_CHANGE_FAIL": "Failed to toggle automation due to \"{{err}}\"",
"AUTOMATION_MANAGER_REFRESH": "aggiornamento automazioni",
"AUTOMATION_MANAGER_REFRESH_FAIL": "Aggiornamento delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_DELETE": "eliminando l'automazione",
"AUTOMATION_MANAGER_DELETE_FAIL": "Eliminazione fallita a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_TRIGGER": "attivando l'automazione",
"AUTOMATION_MANAGER_TRIGGER_FAIL": "Attivazione fallita a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_ADD": "aggiungendo l'automazione",
"AUTOMATION_MANAGER_ADD_FAIL": "Aggiunta delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_UPDATE": "aggironando l'automazione",
"AUTOMATION_MANAGER_UPDATE_FAIL": "Aggiornamento delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_UPDATE_TAGS": "Aggiornando i tag delle automazioni",
"AUTOMATION_MANAGER_UPDATE_TAGS_FAIL": "Aggiornamento dei tag delle automazioni fallito a causa di \"{{err}}\"",
"AUTOMATION_MANAGER_DELETE_LIGHT": "Eliminazione dell'automazione fallita, potresti risolvere aggiornando o riavviando Home Assistant",
"NEW_AUTOMATION": "Nuova Automazione",
"SWITCH_AUTOMATION": "Cambia Automazione",
"N/A": "n/d",
"VALIDATION_AUTOMATION_NAME": "Il nome deve essere lungo almeno un 1 carattere",
"VALIDATION_MAX_TAG_SELECTION": "Puoi selezionare massimo {{count}} tag",
"VALIDATION_TAG_EXISTS": "Il tag '{{name}}' esiste già",
"VALIDATION_PLEASE_CORRECT_FILE": "Perfavore correggi il file dell'automazione manualmente e poi continua !",
"VALIDATION_MISSING_VALUES_FOR_NODE": "Questo nodo contiene dei valori mancanti",
"VALIDATION_ERROR_VALUES_IN_NODE": "Questo nodo contiene errori",
"VALIDATION_UNSAVED_WORK_IN_NODE": "Questo nodo ha delle modifiche non salvate",
"VALIDATION_NOT_ALL_FIELD_FILLED_IN": "Alcuni campi non sono stati compilati correttamente",
"CONFIRM_EXIT": "Sei sicuro di voler {{what}}?",
"MODE_SIGNLE_LABEL": "Non avviare una nuova esecuzione. Fornisci un avvertimento.",
"MODE_SIGNLE_PARALLEL": "Avvia una nuova e indipendente esecuzione in parallelo con le esecuzioni precedenti.",
"MODE_SIGNLE_QUEUED": "Avvia una nuova esecuzione dopo che tutte le altre sono state completate. Le esecuzioni partiranno nell'ordine in cui sono state accodate.",
"MODE_SIGNLE_RESTART": "Avvia una nuova esecuzione dopo aver fermato quella precedente.",
"WARNING_SWITCHING_FROM_NONE_SAVE": "Selezionando un'altra automazione perderai tutte le modifiche effettuate a questa nuova automazione. Salva prima le modifiche.",
"WARNING_DEVICE_NO_TYPES": "Questo dispositivo non ha {{type}}.",
"INFO_SUCCESS_CALL": "{{entityId}} chiamata con successo",
"HOW_MANY_TIMES": "Dati eventoaQuante volte?",
"READONLY_MODE": "Modalità di sola lettura",
"READONLY_CANNOT_UPDATE": "Impossibile aggiornare in modalità di sola lettura"
}
+2 -2
View File
@@ -1,7 +1,7 @@
import * as st from "superstruct";
export const AutomationData = st.object({
id: st.string(),
id: st.nullable(st.string()),
alias: st.optional(st.string()),
description: st.optional(st.string()),
trigger_variables: st.optional(
@@ -20,7 +20,7 @@ export const AutomationData = st.object({
});
export const BareAutomationData = st.object({
id: st.string(),
id: st.nullable(st.string()),
alias: st.optional(st.string()),
description: st.optional(st.string()),
trigger_variables: st.optional(
+1 -1
View File
@@ -1,7 +1,7 @@
import * as st from "superstruct";
export const AutomationMetadata = st.object({
id: st.string(),
id: st.nullable(st.string()),
alias: st.optional(st.string()),
description: st.optional(st.string()),
trigger_variables: st.optional(
+3 -1
View File
@@ -62,7 +62,9 @@ export const getConditionDefaultValues = (
} as any;
};
export const defaultAutomation = (id: string): BareAutomationData => ({
export const defaultAutomation = (
id: string
): BareAutomationData & { id: string } => ({
id,
alias: "New Automation",
description: "",