Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Oct 10, 2024
2 parents cd4d0f5 + 60ab5a3 commit 1c3b1f5
Show file tree
Hide file tree
Showing 37 changed files with 1,319 additions and 1,163 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@
"makefile"
],
"typescript.preferences.preferTypeOnlyAutoImports": true,
"sonarlint.pathToCompileCommands": "${workspaceFolder}/compile_commands.json",
"sonarlint.connectedMode.project": {
"connectionId": "emsesp",
"projectKey": "emsesp_EMS-ESP32"
},
"sonarlint.pathToCompileCommands": "${workspaceFolder}/compile_commands.json"
}
}
1,392 changes: 696 additions & 696 deletions dump_entities.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dump_telegrams.csv
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ telegram_type_id,name,is_fetched
0x02A2,RC300Curves,
0x02A5,RC300Monitor,
0x02A6,RC300Monitor,
0x02A7,RC300Monitor,
0x02A7,CRFMonitor,
0x02A8,RC300Monitor,
0x02A9,RC300Monitor,
0x02AA,RC300Monitor,
Expand Down
2 changes: 1 addition & 1 deletion interface/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default tseslint.config(
}
},
{
ignores: ['dist/*', '*.js', '**/*.cjs', '**/unpack.ts', 'i18n*.*']
ignores: ['dist/*', 'build/*', '*.js', '**/*.cjs', '**/unpack.ts', 'i18n*.*']
},
{
rules: {
Expand Down
14 changes: 7 additions & 7 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"@alova/adapter-xhr": "2.0.7",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^6.1.1",
"@mui/icons-material": "^6.1.2",
"@mui/material": "^6.1.2",
"@table-library/react-table-library": "4.1.7",
"alova": "3.0.17",
"async-validator": "^4.2.5",
"jwt-decode": "^4.0.0",
"mime-types": "^2.1.35",
"preact": "^10.24.1",
"preact": "^10.24.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
Expand All @@ -41,18 +41,18 @@
"typescript": "^5.6.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@eslint/js": "^9.11.1",
"@babel/core": "^7.25.7",
"@eslint/js": "^9.12.0",
"@preact/compat": "^18.3.1",
"@preact/preset-vite": "^2.9.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/formidable": "^3",
"@types/node": "^22.7.4",
"@types/react": "^18.3.10",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
"concurrently": "^9.0.1",
"eslint": "^9.11.1",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"formidable": "^3.5.1",
"prettier": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/main/CustomEntitiesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ const CustomEntitiesDialog = ({
select
>
{DeviceValueUOM_s.map((val, i) => (
<MenuItem key={i} value={i}>
<MenuItem key={val} value={i}>
{val}
</MenuItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/main/Devices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const Devices = () => {
}, [escFunction]);

const customize = () => {
if (selectedDevice == 99) {
if (selectedDevice === 99) {
navigate('/customentities');
} else {
navigate('/customizations', { state: selectedDevice });
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/main/DevicesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const DevicesDialog = ({
value={editItem.v}
disabled={!writeable}
sx={{ width: '30ch' }}
multiline={editItem.u ? false : true}
multiline={!editItem.u}
onChange={updateFormValue}
/>
)}
Expand Down
6 changes: 3 additions & 3 deletions interface/src/app/main/Modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { useI18nContext } from 'i18n/i18n-react';

import { readModules, writeModules } from '../../api/app';
import ModulesDialog from './ModulesDialog';
import type { ModuleItem, Modules } from './types';
import type { ModuleItem } from './types';

const Modules = () => {
const { LL } = useI18nContext();
Expand All @@ -39,6 +39,8 @@ const Modules = () => {
const [selectedModuleItem, setSelectedModuleItem] = useState<ModuleItem>();
const [dialogOpen, setDialogOpen] = useState<boolean>(false);

useLayoutTitle(LL.MODULES());

const {
data: modules,
send: fetchModules,
Expand Down Expand Up @@ -155,8 +157,6 @@ const Modules = () => {
return <FormLoader onRetry={fetchModules} errorMessage={error?.message} />;
}

useLayoutTitle(LL.MODULES());

if (modules.length === 0) {
return (
<Typography variant="body2" color="error">
Expand Down
4 changes: 2 additions & 2 deletions interface/src/app/main/Scheduler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const Scheduler = () => {
const [creating, setCreating] = useState<boolean>(false);
const [dialogOpen, setDialogOpen] = useState<boolean>(false);

useLayoutTitle(LL.SCHEDULER());

const {
data: schedule,
send: fetchSchedule,
Expand Down Expand Up @@ -243,8 +245,6 @@ const Scheduler = () => {
</Box>
);

useLayoutTitle(LL.SCHEDULER());

return (
<Table
data={{
Expand Down
8 changes: 2 additions & 6 deletions interface/src/app/main/SchedulerDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@ const SchedulerDialog = ({
? LL.TIMER(1)
: LL.TIME(1)
}
value={
editItem.time == '' ? (editItem.time = '00:00') : editItem.time
}
value={editItem.time === '' ? '00:00' : editItem.time}
margin="normal"
onChange={updateFormValue}
/>
Expand All @@ -318,9 +316,7 @@ const SchedulerDialog = ({
}
multiline
fullWidth
value={
editItem.time == '00:00' ? (editItem.time = '') : editItem.time
}
value={editItem.time === '00:00' ? '' : editItem.time}
margin="normal"
onChange={updateFormValue}
/>
Expand Down
100 changes: 50 additions & 50 deletions interface/src/app/main/Sensors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,56 @@ const Sensors = () => {
}
]);

const RenderTemperatureSensors = () => (
<Table
data={{ nodes: sensorData.ts }}
theme={temperature_theme}
sort={temperature_sort}
layout={{ custom: true }}
>
{(tableList: TemperatureSensor[]) => (
<>
<Header>
<HeaderRow>
<HeaderCell resize>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
endIcon={getSortIcon(temperature_sort.state, 'NAME')}
onClick={() =>
temperature_sort.fns.onToggleSort({ sortKey: 'NAME' })
}
>
{LL.NAME(0)}
</Button>
</HeaderCell>
<HeaderCell stiff>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
endIcon={getSortIcon(temperature_sort.state, 'VALUE')}
onClick={() =>
temperature_sort.fns.onToggleSort({ sortKey: 'VALUE' })
}
>
{LL.VALUE(0)}
</Button>
</HeaderCell>
</HeaderRow>
</Header>
<Body>
{tableList.map((ts: TemperatureSensor) => (
<Row key={ts.id} item={ts} onClick={() => updateTemperatureSensor(ts)}>
<Cell>{ts.n}</Cell>
<Cell>{formatValue(ts.t, ts.u)}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
);

const getSortIcon = (state: State, sortKey: unknown) => {
if (state.sortKey === sortKey && state.reverse) {
return <KeyboardArrowDownOutlinedIcon />;
Expand Down Expand Up @@ -332,56 +382,6 @@ const Sensors = () => {
});
};

const RenderTemperatureSensors = () => (
<Table
data={{ nodes: sensorData.ts }}
theme={temperature_theme}
sort={temperature_sort}
layout={{ custom: true }}
>
{(tableList: TemperatureSensor[]) => (
<>
<Header>
<HeaderRow>
<HeaderCell resize>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
endIcon={getSortIcon(temperature_sort.state, 'NAME')}
onClick={() =>
temperature_sort.fns.onToggleSort({ sortKey: 'NAME' })
}
>
{LL.NAME(0)}
</Button>
</HeaderCell>
<HeaderCell stiff>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
endIcon={getSortIcon(temperature_sort.state, 'VALUE')}
onClick={() =>
temperature_sort.fns.onToggleSort({ sortKey: 'VALUE' })
}
>
{LL.VALUE(0)}
</Button>
</HeaderCell>
</HeaderRow>
</Header>
<Body>
{tableList.map((ts: TemperatureSensor) => (
<Row key={ts.id} item={ts} onClick={() => updateTemperatureSensor(ts)}>
<Cell>{ts.n}</Cell>
<Cell>{formatValue(ts.t, ts.u)}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
);

const RenderAnalogSensors = () => (
<Table
data={{ nodes: sensorData.as }}
Expand Down
4 changes: 2 additions & 2 deletions interface/src/app/main/SensorsAnalogDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const SensorsAnalogDialog = ({
onChange={updateFormValue}
>
{AnalogTypeNames.map((val, i) => (
<MenuItem key={i} value={i}>
<MenuItem key={val} value={i}>
{val}
</MenuItem>
))}
Expand All @@ -143,7 +143,7 @@ const SensorsAnalogDialog = ({
onChange={updateFormValue}
>
{DeviceValueUOM_s.map((val, i) => (
<MenuItem key={i} value={i}>
<MenuItem key={val} value={i}>
{val}
</MenuItem>
))}
Expand Down
20 changes: 10 additions & 10 deletions interface/src/app/main/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ export const DeviceValueUOM_s = [
export enum AnalogType {
REMOVED = -1,
NOTUSED = 0,
DIGITAL_IN,
COUNTER,
ADC,
TIMER,
RATE,
DIGITAL_OUT,
PWM_0,
PWM_1,
PWM_2
DIGITAL_IN = 1,
COUNTER = 2,
ADC = 3,
TIMER = 4,
RATE = 5,
DIGITAL_OUT = 6,
PWM_0 = 7,
PWM_1 = 8,
PWM_2 = 9
}

export const AnalogTypeNames = [
Expand Down Expand Up @@ -296,7 +296,7 @@ export interface ScheduleItem {
active: boolean;
deleted?: boolean;
flags: number;
time: string;
time: string; // also used for Condition and On Change
cmd: string;
value: string;
name: string; // is optional
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/status/APStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const apStatusHighlight = ({ status }: APStatusType, theme: Theme) => {

const APStatus = () => {
const {
data: data,
data,
send: loadData,
error
} = useAutoRequest(APApi.readAPStatus, { pollingTime: 5000 });
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/status/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { Stat } from '../main/types';

const SystemActivity = () => {
const {
data: data,
data,
send: loadData,
error
} = useAutoRequest(readActivity, { pollingTime: 2000 });
Expand Down
5 changes: 3 additions & 2 deletions interface/src/app/status/HardwareStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const HardwareStatus = () => {
useLayoutTitle(LL.STATUS_OF(LL.HARDWARE()));

const {
data: data,
data,
send: loadData,
error
} = useAutoRequest(SystemApi.readSystemStatus, { pollingTime: 2000 });
Expand All @@ -50,6 +50,7 @@ const HardwareStatus = () => {
{data.model ? (
<Avatar sx={{ bgcolor: '#003289', color: 'white' }}>
<img
alt="BBQKees"
src={BBQKeesIcon}
style={{ width: 16, verticalAlign: 'middle' }}
/>
Expand Down Expand Up @@ -93,7 +94,7 @@ const HardwareStatus = () => {
' (rev.' +
data.cpu_rev +
', ' +
(data.cpu_cores == 1 ? 'single-core)' : 'dual-core)') +
(data.cpu_cores === 1 ? 'single-core)' : 'dual-core)') +
' @ ' +
data.cpu_freq_mhz +
' Mhz'
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/status/MqttStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const mqttQueueHighlight = (

const MqttStatus = () => {
const {
data: data,
data,
send: loadData,
error
} = useAutoRequest(MqttApi.readMqttStatus, { pollingTime: 5000 });
Expand Down
2 changes: 1 addition & 1 deletion interface/src/app/status/NTPStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { formatDateTime, formatLocalDateTime } from 'utils';

const NTPStatus = () => {
const {
data: data,
data,
send: loadData,
error
} = useAutoRequest(NTPApi.readNTPStatus, { pollingTime: 5000 });
Expand Down
Loading

0 comments on commit 1c3b1f5

Please sign in to comment.