This commit is contained in:
MichaelDvP
2025-12-18 07:20:50 +01:00
7 changed files with 30 additions and 29 deletions

View File

@@ -41,7 +41,7 @@
"react": "^19.2.3", "react": "^19.2.3",
"react-dom": "^19.2.3", "react-dom": "^19.2.3",
"react-icons": "^5.5.0", "react-icons": "^5.5.0",
"react-router": "^7.10.1", "react-router": "^7.11.0",
"react-toastify": "^11.0.5", "react-toastify": "^11.0.5",
"typesafe-i18n": "^5.26.2", "typesafe-i18n": "^5.26.2",
"typescript": "^5.9.3" "typescript": "^5.9.3"

View File

@@ -63,8 +63,8 @@ importers:
specifier: ^5.5.0 specifier: ^5.5.0
version: 5.5.0(react@19.2.3) version: 5.5.0(react@19.2.3)
react-router: react-router:
specifier: ^7.10.1 specifier: ^7.11.0
version: 7.10.1(react-dom@19.2.3(react@19.2.3))(react@19.2.3) version: 7.11.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
react-toastify: react-toastify:
specifier: ^11.0.5 specifier: ^11.0.5
version: 11.0.5(react-dom@19.2.3(react@19.2.3))(react@19.2.3) version: 11.0.5(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
@@ -1027,8 +1027,8 @@ packages:
base64-js@1.5.1: base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
baseline-browser-mapping@2.9.8: baseline-browser-mapping@2.9.9:
resolution: {integrity: sha512-Y1fOuNDowLfgKOypdc9SPABfoWXuZHBOyCS4cD52IeZBhr4Md6CLLs6atcxVrzRmQ06E7hSlm5bHHApPKR/byA==} resolution: {integrity: sha512-V8fbOCSeOFvlDj7LLChUcqbZrdKD9RU/VR260piF1790vT0mfLSwGc/Qzxv3IqiTukOpNtItePa0HBpMAj7MDg==}
hasBin: true hasBin: true
bin-build@3.0.0: bin-build@3.0.0:
@@ -2525,8 +2525,8 @@ packages:
react-is@19.2.3: react-is@19.2.3:
resolution: {integrity: sha512-qJNJfu81ByyabuG7hPFEbXqNcWSU3+eVus+KJs+0ncpGfMyYdvSmxiJxbWR65lYi1I+/0HBcliO029gc4F+PnA==} resolution: {integrity: sha512-qJNJfu81ByyabuG7hPFEbXqNcWSU3+eVus+KJs+0ncpGfMyYdvSmxiJxbWR65lYi1I+/0HBcliO029gc4F+PnA==}
react-router@7.10.1: react-router@7.11.0:
resolution: {integrity: sha512-gHL89dRa3kwlUYtRQ+m8NmxGI6CgqN+k4XyGjwcFoQwwCWF6xXpOCUlDovkXClS0d0XJN/5q7kc5W3kiFEd0Yw==} resolution: {integrity: sha512-uI4JkMmjbWCZc01WVP2cH7ZfSzH91JAZUDd7/nIprDgWxBV1TkkmLToFh7EbMTcMak8URFRa2YoBL/W8GWnCTQ==}
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
peerDependencies: peerDependencies:
react: '>=18' react: '>=18'
@@ -3958,7 +3958,7 @@ snapshots:
base64-js@1.5.1: {} base64-js@1.5.1: {}
baseline-browser-mapping@2.9.8: {} baseline-browser-mapping@2.9.9: {}
bin-build@3.0.0: bin-build@3.0.0:
dependencies: dependencies:
@@ -4015,7 +4015,7 @@ snapshots:
browserslist@4.28.1: browserslist@4.28.1:
dependencies: dependencies:
baseline-browser-mapping: 2.9.8 baseline-browser-mapping: 2.9.9
caniuse-lite: 1.0.30001760 caniuse-lite: 1.0.30001760
electron-to-chromium: 1.5.267 electron-to-chromium: 1.5.267
node-releases: 2.0.27 node-releases: 2.0.27
@@ -5525,7 +5525,7 @@ snapshots:
react-is@19.2.3: {} react-is@19.2.3: {}
react-router@7.10.1(react-dom@19.2.3(react@19.2.3))(react@19.2.3): react-router@7.11.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3):
dependencies: dependencies:
cookie: 1.1.1 cookie: 1.1.1
react: 19.2.3 react: 19.2.3

View File

@@ -108,16 +108,18 @@ const SensorsAnalogDialog = ({
// Memoize menu items to avoid recreation on each render // Memoize menu items to avoid recreation on each render
const analogTypeMenuItems = useMemo( const analogTypeMenuItems = useMemo(
() => () =>
AnalogTypeNames.map((val, i) => ( AnalogTypeNames.map((val, i) => ({ name: val, value: i + 1 }))
<MenuItem .sort((a, b) => a.name.localeCompare(b.name))
key={val} .map(({ name, value }) => (
value={i + 1} <MenuItem
disabled={disabledTypeList.includes(i + 1)} key={name}
> value={value}
{val} disabled={disabledTypeList?.includes(value)}
</MenuItem> >
)), {name}
[] </MenuItem>
)),
[disabledTypeList]
); );
const uomMenuItems = useMemo( const uomMenuItems = useMemo(

View File

@@ -262,7 +262,7 @@ export const AnalogTypeNames = [
'PWM 0', // 7 'PWM 0', // 7
'PWM 1', // 8 'PWM 1', // 8
'PWM 2', // 9 'PWM 2', // 9
'NTC Temp.', // 10 'NTC Temp', // 10
'RGB Led', // 11 'RGB Led', // 11
'Pulse', // 12 'Pulse', // 12
'Freq 0', // 13 'Freq 0', // 13
@@ -270,7 +270,7 @@ export const AnalogTypeNames = [
'Freq 2', // 15 'Freq 2', // 15
'Counter 0', // 16 'Counter 0', // 16
'Counter 1', // 17 'Counter 1', // 17
'Counter2' // 18 'Counter 2' // 18
] as const; ] as const;
export const BOARD_PROFILES = { export const BOARD_PROFILES = {

View File

@@ -2,9 +2,7 @@ import { useMemo } from 'react';
import { MenuItem } from '@mui/material'; import { MenuItem } from '@mui/material';
type TimeZones = Record<string, string>; export const TIME_ZONES: Record<string, string> = {
export const TIME_ZONES: Readonly<TimeZones> = {
'Africa/Abidjan': 'GMT0', 'Africa/Abidjan': 'GMT0',
'Africa/Accra': 'GMT0', 'Africa/Accra': 'GMT0',
'Africa/Addis_Ababa': 'EAT-3', 'Africa/Addis_Ababa': 'EAT-3',

View File

@@ -1048,7 +1048,9 @@ const emsesp_sensordata = {
} }
], ],
analog_enabled: true, analog_enabled: true,
available_gpios: [] as number[] available_gpios: [] as number[],
exclude_types: [] as number[],
platform: 'ESP32'
}; };
const activity = { const activity = {

View File

@@ -1451,7 +1451,7 @@ void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const char * mo
// create dev section // create dev section
JsonObject dev_json = doc["dev"].to<JsonObject>(); JsonObject dev_json = doc["dev"].to<JsonObject>();
// add ids and name - with capitalize first letter // add ids and name - capitalize first letter of the name
JsonArray ids = dev_json["ids"].to<JsonArray>(); // ids, it is an array with a single element JsonArray ids = dev_json["ids"].to<JsonArray>(); // ids, it is an array with a single element
if (name != nullptr) { if (name != nullptr) {
// for ids, replace all spaces with - // for ids, replace all spaces with -
@@ -1464,8 +1464,7 @@ void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const char * mo
dev_json["name"] = Mqtt::basename() + " " + cap_name; dev_json["name"] = Mqtt::basename() + " " + cap_name;
free(cap_name); free(cap_name);
} else { } else {
ids.add(Mqtt::basename()); ids.add(Mqtt::basename()); // no name, assign it to the main EMS-ESP device in HA
dev_json["name"] = Mqtt::basename();
} }
// create the model, manufacturer and version // create the model, manufacturer and version