Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into idf4_n…
Browse files Browse the repository at this point in the history
…o_master
  • Loading branch information
MichaelDvP committed May 23, 2022
2 parents 6670dfd + 7f58707 commit c502aa7
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 216 deletions.
400 changes: 198 additions & 202 deletions interface/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions interface/package.json
Expand Up @@ -12,8 +12,8 @@
"@table-library/react-table-library": "^3.1.2",
"@types/lodash": "^4.14.182",
"@types/node": "^17.0.35",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"@types/react-router-dom": "^5.3.3",
"async-validator": "^4.1.1",
"axios": "^0.27.2",
Expand All @@ -22,9 +22,9 @@
"lodash": "^4.17.21",
"notistack": "^2.0.5",
"parse-ms": "^3.0.0",
"react": "^17.0.2",
"react": "^18.1.0",
"react-app-rewired": "^2.2.1",
"react-dom": "^17.0.2",
"react-dom": "^18.1.0",
"react-dropzone": "^14.2.1",
"react-icons": "^4.3.1",
"react-router-dom": "^6.3.0",
Expand Down
4 changes: 3 additions & 1 deletion interface/src/CustomTheme.tsx
Expand Up @@ -4,6 +4,8 @@ import { CssBaseline } from '@mui/material';
import { createTheme, responsiveFontSizes, ThemeProvider } from '@mui/material/styles';
import { blueGrey, blue } from '@mui/material/colors';

import { RequiredChildrenProps } from './utils';

const theme = responsiveFontSizes(
createTheme({
typography: {
Expand All @@ -21,7 +23,7 @@ const theme = responsiveFontSizes(
})
);

const CustomTheme: FC = ({ children }) => (
const CustomTheme: FC<RequiredChildrenProps> = ({ children }) => (
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
Expand Down
4 changes: 3 additions & 1 deletion interface/src/components/SectionContent.tsx
Expand Up @@ -2,7 +2,9 @@ import { FC } from 'react';

import { Paper, Divider } from '@mui/material';

interface SectionContentProps {
import { RequiredChildrenProps } from '../utils';

interface SectionContentProps extends RequiredChildrenProps {
title: string;
titleGutter?: boolean;
id?: string;
Expand Down
4 changes: 3 additions & 1 deletion interface/src/components/layout/Layout.tsx
Expand Up @@ -4,13 +4,15 @@ import { useLocation } from 'react-router-dom';
import { Box, Toolbar } from '@mui/material';

import { PROJECT_NAME } from '../../api/env';
import { RequiredChildrenProps } from '../../utils';

import LayoutDrawer from './LayoutDrawer';
import LayoutAppBar from './LayoutAppBar';
import { LayoutContext } from './context';

export const DRAWER_WIDTH = 240;

const Layout: FC = ({ children }) => {
const Layout: FC<RequiredChildrenProps> = ({ children }) => {
const [mobileOpen, setMobileOpen] = useState(false);
const [title, setTitle] = useState(PROJECT_NAME);
const { pathname } = useLocation();
Expand Down
3 changes: 2 additions & 1 deletion interface/src/components/routing/RequireAdmin.tsx
Expand Up @@ -2,8 +2,9 @@ import { FC, useContext } from 'react';
import { Navigate } from 'react-router-dom';

import { AuthenticatedContext } from '../../contexts/authentication';
import { RequiredChildrenProps } from '../../utils';

const RequireAdmin: FC = ({ children }) => {
const RequireAdmin: FC<RequiredChildrenProps> = ({ children }) => {
const authenticatedContext = useContext(AuthenticatedContext);
return authenticatedContext.me.admin ? <>{children}</> : <Navigate replace to="/" />;
};
Expand Down
4 changes: 3 additions & 1 deletion interface/src/components/routing/RequireAuthenticated.tsx
Expand Up @@ -8,7 +8,9 @@ import {
} from '../../contexts/authentication/context';
import { storeLoginRedirect } from '../../api/authentication';

const RequireAuthenticated: FC = ({ children }) => {
import { RequiredChildrenProps } from '../../utils';

const RequireAuthenticated: FC<RequiredChildrenProps> = ({ children }) => {
const authenticationContext = useContext(AuthenticationContext);
const location = useLocation();

Expand Down
3 changes: 2 additions & 1 deletion interface/src/components/routing/RequireUnauthenticated.tsx
Expand Up @@ -3,9 +3,10 @@ import { Navigate } from 'react-router-dom';

import * as AuthenticationApi from '../../api/authentication';
import { AuthenticationContext } from '../../contexts/authentication';
import { RequiredChildrenProps } from '../../utils';
import { FeaturesContext } from '../../contexts/features';

const RequireUnauthenticated: FC = ({ children }) => {
const RequireUnauthenticated: FC<RequiredChildrenProps> = ({ children }) => {
const { features } = useContext(FeaturesContext);
const authenticationContext = useContext(AuthenticationContext);

Expand Down
4 changes: 3 additions & 1 deletion interface/src/components/routing/RouterTabs.tsx
Expand Up @@ -3,7 +3,9 @@ import { useNavigate } from 'react-router-dom';

import { Tabs, useMediaQuery, useTheme } from '@mui/material';

interface RouterTabsProps {
import { RequiredChildrenProps } from '../../utils';

interface RouterTabsProps extends RequiredChildrenProps {
value: string | false;
}

Expand Down
3 changes: 2 additions & 1 deletion interface/src/contexts/authentication/Authentication.tsx
Expand Up @@ -4,12 +4,13 @@ import { useNavigate } from 'react-router-dom';

import * as AuthenticationApi from '../../api/authentication';
import { ACCESS_TOKEN } from '../../api/endpoints';
import { RequiredChildrenProps } from '../../utils';
import { LoadingSpinner } from '../../components';
import { Me } from '../../types';
import { FeaturesContext } from '../features';
import { AuthenticationContext } from './context';

const Authentication: FC = ({ children }) => {
const Authentication: FC<RequiredChildrenProps> = ({ children }) => {
const { features } = useContext(FeaturesContext);
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
Expand Down
4 changes: 2 additions & 2 deletions interface/src/contexts/features/FeaturesLoader.tsx
Expand Up @@ -2,13 +2,13 @@ import { FC, useCallback, useEffect, useState } from 'react';

import * as FeaturesApi from '../../api/features';

import { extractErrorMessage } from '../../utils';
import { extractErrorMessage, RequiredChildrenProps } from '../../utils';
import { Features } from '../../types';
import { ApplicationError, LoadingSpinner } from '../../components';

import { FeaturesContext } from '.';

const FeaturesLoader: FC = (props) => {
const FeaturesLoader: FC<RequiredChildrenProps> = (props) => {
const [errorMessage, setErrorMessage] = useState<string>();
const [features, setFeatures] = useState<Features>();

Expand Down
1 change: 1 addition & 0 deletions interface/src/utils/index.ts
Expand Up @@ -4,3 +4,4 @@ export * from './route';
export * from './submit';
export * from './time';
export * from './useRest';
export * from './props';
3 changes: 3 additions & 0 deletions interface/src/utils/props.ts
@@ -0,0 +1,3 @@
export interface RequiredChildrenProps {
children: React.ReactNode;
}
39 changes: 39 additions & 0 deletions src/devices/boiler.cpp
Expand Up @@ -205,6 +205,22 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(maintenanceDate),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maintenancedate));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&emergencyOps_,
DeviceValueType::BOOL,
nullptr,
FL_(emergencyOps),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_emergency_ops));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&emergencyTemp_,
DeviceValueType::UINT,
nullptr,
FL_(emergencyTemp),
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_emergency_temp),
40,
70);

/*
* Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat
Expand Down Expand Up @@ -783,6 +799,9 @@ void Boiler::process_UBAParametersPlus(std::shared_ptr<const Telegram> telegram)
has_update(telegram, boilHystOff_, 8);
has_update(telegram, boilHystOn_, 9);
has_update(telegram, burnMinPeriod_, 10);
has_update(telegram, emergencyOps_, 18);
has_update(telegram, emergencyTemp_, 19);

// has_update(telegram, pumpType_, 11); // guess, RC300 manual: power controlled, pressure controlled 1-4?
// has_update(telegram, pumpDelay_, 12); // guess
// has_update(telegram, pumpModMax_, 13); // guess
Expand Down Expand Up @@ -1853,4 +1872,24 @@ bool Boiler::set_pool_temp(const char * value, const int8_t id) {
return true;
}

bool Boiler::set_emergency_temp(const char * value, const int8_t id) {
int v = 0;
if (!Helpers::value2temperature(value, v)) {
return false;
}

write_command(EMS_TYPE_UBAParametersPlus, 19, v, EMS_TYPE_UBAParametersPlus);

return true;
}

bool Boiler::set_emergency_ops(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
return false;
}
write_command(EMS_TYPE_UBAParametersPlus, 18, v ? 0x01 : 0x00, EMS_TYPE_UBAParametersPlus);
return true;
}

} // namespace emsesp
4 changes: 4 additions & 0 deletions src/devices/boiler.h
Expand Up @@ -134,6 +134,8 @@ class Boiler : public EMSdevice {
char lastCode_[50]; // last error code
char serviceCode_[4]; // 3 character status/service code
uint16_t serviceCodeNumber_; // error/service code
uint8_t emergencyOps_;
uint8_t emergencyTemp_;

// info
uint32_t upTimeControl_; // Operating time control
Expand Down Expand Up @@ -278,6 +280,8 @@ class Boiler : public EMSdevice {
bool set_ww_hyst_on(const char * value, const int8_t id);
bool set_ww_hyst_off(const char * value, const int8_t id);
bool set_pool_temp(const char * value, const int8_t id);
bool set_emergency_temp(const char * value, const int8_t id);
bool set_emergency_ops(const char * value, const int8_t id);
/*
bool set_hybridStrategy(const char * value, const int8_t id);
bool set_switchOverTemp(const char * value, const int8_t id);
Expand Down
2 changes: 2 additions & 0 deletions src/locale_EN.h
Expand Up @@ -463,6 +463,8 @@ MAKE_PSTR_LIST(maintenanceMessage, F("maintenancemessage"), F("maintenance messa
MAKE_PSTR_LIST(maintenanceDate, F("maintenancedate"), F("next maintenance date"))
MAKE_PSTR_LIST(maintenanceType, F_(maintenance), F("maintenance scheduled"))
MAKE_PSTR_LIST(maintenanceTime, F("maintenancetime"), F("time to next maintenance"))
MAKE_PSTR_LIST(emergencyOps, F("emergencyops"), F("emergency operation"))
MAKE_PSTR_LIST(emergencyTemp, F("emergencytemp"), F("emergency temperature"))

// heatpump/compress specific
MAKE_PSTR_LIST(upTimeControl, F("uptimecontrol"), F("total operating time heat"))
Expand Down

0 comments on commit c502aa7

Please sign in to comment.