Merge branch 'dev' into core3

This commit is contained in:
MichaelDvP
2026-07-10 13:19:39 +02:00
21 changed files with 6325 additions and 6126 deletions

View File

@@ -7,6 +7,7 @@ import {
Box,
Button,
Checkbox,
Grid,
Dialog,
DialogActions,
DialogContent,
@@ -39,7 +40,7 @@ import { ValidationError, validate } from 'validators';
import { NTP_SETTINGS_VALIDATOR } from 'validators/ntp';
import type { ValidateFieldsError } from 'validators/schema';
import { TIME_ZONES, selectedTimeZone, useTimeZoneSelectItems } from './TZ';
import { TIME_ZONES, selectedTimeZone, useTimeZoneSelectItems, timeZoneSelectItemsT } from './TZ';
const NTPSettings = () => {
const {
@@ -62,11 +63,15 @@ const NTPSettings = () => {
useLayoutTitle('NTP');
const timeZoneItems = useTimeZoneSelectItems();
const timeZoneItemsT = timeZoneSelectItemsT();
const selectedTzValue = data
? selectedTimeZone(data.tz_label, data.tz_format)
: undefined;
const selectedTzValueT = data
? selectedTimeZone(data.tz_label_t, data.tz_format_t)
: undefined;
const [localTime, setLocalTime] = useState<string>('');
const [settingTime, setSettingTime] = useState<boolean>(false);
const [processing, setProcessing] = useState<boolean>(false);
@@ -154,6 +159,7 @@ const NTPSettings = () => {
label={LL.NTP_SERVER()}
fullWidth
variant="outlined"
disabled={!data.enabled}
value={data.server}
onChange={updateFormValue}
margin="normal"
@@ -172,7 +178,45 @@ const NTPSettings = () => {
<MenuItem disabled>{LL.TIME_ZONE()}...</MenuItem>
{timeZoneItems}
</ValidatedTextField>
{data.enabled && (
<Grid container spacing={2} rowSpacing={0}>
<Grid>
<ValidatedTextField
fieldErrors={fieldErrors || {}}
name="thermostat_sync"
label="Sync EMS-Thermostat"
variant="outlined"
sx={{ width: '30ch' }}
value={data.thermostat_sync}
onChange={updateFormValue}
margin="normal"
select
>
<MenuItem value={0}>{LL.OFF()}</MenuItem>
<MenuItem value={1}>{LL.ON()}</MenuItem >
<MenuItem value={2} >{LL.USE()} {LL.TIME_ZONE()}</MenuItem >
</ValidatedTextField >
</Grid>
<Grid>
{data.thermostat_sync === 2 && (
<ValidatedTextField
fieldErrors={fieldErrors || {}}
name="tz_label_t"
label={LL.TIME_ZONE() + ' Thermostat'}
sx={{ width: '30ch' }}
variant="outlined"
value={selectedTzValueT}
onChange={changeTimeZoneT}
margin="normal"
select
>
<MenuItem disabled>{LL.TIME_ZONE()}...</MenuItem>
{timeZoneItemsT}
</ValidatedTextField>
)}
</Grid>
</Grid>
)}
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
{!data.enabled && !dirtyFlags.length && (
<Box sx={{ flexWrap: 'nowrap', whiteSpace: 'nowrap' }}>

View File

@@ -483,3 +483,7 @@ export function useTimeZoneSelectItems() {
export function timeZoneSelectItems() {
return precomputedTimeZoneItems;
}
export function timeZoneSelectItemsT() {
return precomputedTimeZoneItems;
}