Skip to content

Commit

Permalink
Merge pull request #1632 from MichaelDvP/dev2
Browse files Browse the repository at this point in the history
update to all dev changes
  • Loading branch information
proddy authored Feb 23, 2024
2 parents ef47ee6 + 222aaca commit df982e3
Show file tree
Hide file tree
Showing 322 changed files with 9,265 additions and 11,144 deletions.
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.vscode/c_cpp_properties.json
.vscode/extensions.json
.vscode/launch.json
# .vscode/settings.json
.vscode/settings.json

# c++ compiling
.clang_complete
Expand All @@ -12,11 +12,11 @@ cppcheck.out.xml
# platformio
.pio
pio_local.ini
*_old

# OS specific
.DS_Store
*Thumbs.db
emsesp

# web specfic
build/
Expand All @@ -38,12 +38,13 @@ stats.html
!.yarn/versions
yarn.lock
interface/analyse.html
interface/vite.config.ts.timestamp*

# scripts
test.sh
scripts/run.sh
scripts/__pycache__
/scripts/stackdmp.txt
scripts/stackdmp.txt

# i18n generated files
interface/src/i18n/i18n-react.tsx
Expand All @@ -57,7 +58,5 @@ interface/src/i18n/i18n-util.async.ts
sonar/
bw-output/

# entity dump results
# dump_entities.csv
# dump_entities.xls*

# testing
emsesp
9 changes: 8 additions & 1 deletion CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## **IMPORTANT! BREAKING CHANGES**

- new device WATER shows dhw entities from MM100 and SM100 in dhw setting
- The Wifi Tx Power setting in Network Settings will be reset to Auto

## Added

Expand All @@ -13,7 +14,7 @@
- heatpump energy meters [#1463](https://github.com/emsesp/EMS-ESP32/issues/1463)
- heatpump max power [#1475](https://github.com/emsesp/EMS-ESP32/issues/1475)
- checkbox for MQTT-TLS enable [#1474](https://github.com/emsesp/EMS-ESP32/issues/1474)
- added SK (Slovenian) language. Thanks @misa1515
- added SK (Slovak) language. Thanks @misa1515
- CPU info [#1497](https://github.com/emsesp/EMS-ESP32/pull/1497)
- Show network hostname in Web UI under Network Status
- Improved HA Discovery so each section (EMS device, Scheduler, Analog, Temperature, Custom, Shower) have their own section
Expand All @@ -31,10 +32,16 @@
- MQTT autodiscovery in Domoticz not working [#1360](https://github.com/emsesp/EMS-ESP32/issues/1528)
- dhw comfort for new ems+, [#1495](https://github.com/emsesp/EMS-ESP32/issues/1495)
- added writeable icon to Web's Custom Entity page for each entity shown in the table
- Wifi Tx Power not adjusted [#1614](https://github.com/emsesp/EMS-ESP32/issues/1614)
- MQTT discovery of custom entity doesn't consider type of data [#1587](https://github.com/emsesp/EMS-ESP32/issues/1587)
- WiFi TxPower wasn't correctly used. Added an 'Auto' setting, which is the default.

## Changed

- use flag for BC400 compatible thermostats, manage different mode settings
- HA don't set entity_category to Diagnostic/Configuration for EMS entities [#1459](https://github.com/emsesp/EMS-ESP32/discussions/1459)
- upgraded ArduinoJson to 7.0.0 #1538 and then 7.0.2
- small changes to the API for analog and temperature sensors
- Length of mqtt Broker adress [#1619](https://github.com/emsesp/EMS-ESP32/issues/1619)
- C++ optimizations - see <https://github.com/emsesp/EMS-ESP32/pull/1615>
- Send MQTT heartbeat immediately after connection [#1628](https://github.com/emsesp/EMS-ESP32/issues/1628)
10 changes: 5 additions & 5 deletions esp32_partition_16M.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, , 0x2000,
app0, app, ota_0, , 0x7F0000,
app1, app, ota_1, , 0x7F0000,
spiffs, data, spiffs, , 64K,
nvs, data, nvs, 0x9000, 0x035000,
otadata, data, ota, , 0x002000,
app0, app, ota_0, , 0x6E0000,
app1, app, ota_1, , 0x6E0000,
spiffs, data, spiffs, , 0x200000,
1 change: 0 additions & 1 deletion factory_settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ build_flags =
-D FACTORY_MQTT_PORT=1883
-D FACTORY_MQTT_USERNAME=\"\"
-D FACTORY_MQTT_PASSWORD=\"\"
-D FACTORY_MQTT_CLIENT_ID=\"ems-esp\"
-D FACTORY_MQTT_KEEP_ALIVE=60
-D FACTORY_MQTT_CLEAN_SESSION=false
-D FACTORY_MQTT_MAX_TOPIC_LENGTH=128
Expand Down
4 changes: 2 additions & 2 deletions interface/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
},
"extends": [
"eslint:recommended",
"airbnb/hooks",
"airbnb-typescript",
// "airbnb/hooks",
// "airbnb-typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion interface/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
26 changes: 12 additions & 14 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"@babel/core": "^7.23.9",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.6",
"@mui/material": "^5.15.6",
"@mui/icons-material": "^5.15.10",
"@mui/material": "^5.15.10",
"@table-library/react-table-library": "4.1.7",
"@types/imagemin": "^8.0.5",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.11.10",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/node": "^20.11.20",
"@types/react": "^18.2.57",
"@types/react-dom": "^18.2.19",
"@types/react-router-dom": "^5.3.3",
"alova": "^2.17.0",
"async-validator": "^4.2.5",
Expand All @@ -45,7 +45,7 @@
"react-dom": "latest",
"react-dropzone": "^14.2.3",
"react-icons": "^5.0.1",
"react-router-dom": "^6.21.3",
"react-router-dom": "^6.22.1",
"react-toastify": "^10.0.4",
"sockette": "^2.0.6",
"typesafe-i18n": "^5.26.2",
Expand All @@ -54,12 +54,10 @@
"devDependencies": {
"@preact/compat": "^17.1.2",
"@preact/preset-vite": "^2.8.1",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-autofix": "^1.1.0",
Expand All @@ -68,11 +66,11 @@
"eslint-plugin-prettier": "alpha",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"preact": "^10.19.3",
"prettier": "^3.2.4",
"preact": "^10.19.6",
"prettier": "^3.2.5",
"rollup-plugin-visualizer": "^5.12.0",
"terser": "^5.27.0",
"vite": "^5.0.12",
"terser": "^5.27.2",
"vite": "^5.1.4",
"vite-plugin-imagemin": "^0.6.1",
"vite-tsconfig-paths": "^4.3.1"
},
Expand Down
20 changes: 17 additions & 3 deletions interface/progmem-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { readdirSync, existsSync, unlinkSync, readFileSync, createWriteStream }
import { resolve, relative, sep } from 'path';
import zlib from 'zlib';
import mime from 'mime-types';
import crypto from 'crypto';

const ARDUINO_INCLUDES = '#include <Arduino.h>\n\n';
const INDENT = ' ';
Expand All @@ -11,14 +12,17 @@ const bytesPerLine = 20;
var totalSize = 0;

const generateWWWClass = () =>
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len)> RouteRegistrationHandler;
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len, const String& hash)> RouteRegistrationHandler;
// Total size is ${totalSize} bytes
class WWWData {
${indent}public:
${indent.repeat(2)}static void registerRoutes(RouteRegistrationHandler handler) {
${fileInfo
.map((file) => `${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size});`)
.map(
(file) =>
`${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size}, "${file.hash}");`
)
.join('\n')}
${indent.repeat(2)}}
};
Expand Down Expand Up @@ -50,6 +54,12 @@ const writeFile = (relativeFilePath, buffer) => {
writeStream.write('const uint8_t ' + variable + '[] = {');
// const zipBuffer = zlib.brotliCompressSync(buffer, { quality: 1 });
const zipBuffer = zlib.gzipSync(buffer, { level: 9 });

// create sha
const hashSum = crypto.createHash('sha256');
hashSum.update(zipBuffer);
const hash = hashSum.digest('hex');

zipBuffer.forEach((b) => {
if (!(size % bytesPerLine)) {
writeStream.write('\n');
Expand All @@ -58,15 +68,19 @@ const writeFile = (relativeFilePath, buffer) => {
writeStream.write('0x' + ('00' + b.toString(16).toUpperCase()).slice(-2) + ',');
size++;
});

if (size % bytesPerLine) {
writeStream.write('\n');
}

writeStream.write('};\n\n');

fileInfo.push({
uri: '/' + relativeFilePath.replace(sep, '/'),
mimeType,
variable,
size
size,
hash
});

// console.log(relativeFilePath + ' (size ' + size + ' bytes)');
Expand Down
5 changes: 1 addition & 4 deletions interface/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ToastContainer, Slide } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.min.css';

import { localStorageDetector } from 'typesafe-i18n/detectors';
import { FeaturesLoader } from './contexts/features';
import type { FC } from 'react';
import AppRouting from 'AppRouting';
import CustomTheme from 'CustomTheme';
Expand All @@ -27,9 +26,7 @@ const App: FC = () => {
return (
<TypesafeI18n locale={detectedLocale}>
<CustomTheme>
<FeaturesLoader>
<AppRouting />
</FeaturesLoader>
<AppRouting />
<ToastContainer
position="bottom-left"
autoClose={3000}
Expand Down
4 changes: 0 additions & 4 deletions interface/src/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box, Paper, Typography, MenuItem, TextField, Button } from '@mui/materi
import { useRequest } from 'alova';
import { useContext, useState } from 'react';
import { toast } from 'react-toastify';
import { FeaturesContext } from './contexts/features';
import type { ValidateFieldsError } from 'async-validator';

import type { Locales } from 'i18n/i18n-types';
Expand Down Expand Up @@ -35,8 +34,6 @@ const SignIn: FC = () => {

const { LL, setLocale, locale } = useContext(I18nContext);

const { features } = useContext(FeaturesContext);

const [signInRequest, setSignInRequest] = useState<SignInRequest>({
username: '',
password: ''
Expand Down Expand Up @@ -112,7 +109,6 @@ const SignIn: FC = () => {
})}
>
<Typography variant="h4">{PROJECT_NAME}</Typography>
<Typography variant="subtitle2">{features.version}</Typography>

<TextField name="locale" variant="outlined" value={locale} onChange={onLocaleSelected} size="small" select>
<MenuItem key="de" value="de">
Expand Down
5 changes: 0 additions & 5 deletions interface/src/api/features.ts

This file was deleted.

25 changes: 0 additions & 25 deletions interface/src/contexts/features/FeaturesLoader.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions interface/src/contexts/features/context.ts

This file was deleted.

2 changes: 0 additions & 2 deletions interface/src/contexts/features/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions interface/src/framework/mqtt/MqttSettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const MqttSettingsForm: FC = () => {
name="host"
label={LL.ADDRESS_OF(LL.BROKER())}
fullWidth
multiline
variant="outlined"
value={data.host}
onChange={updateFormValue}
Expand Down
Loading

0 comments on commit df982e3

Please sign in to comment.