Skip to content

Commit

Permalink
Merge pull request #1832 from mheyse/feat/modbus
Browse files Browse the repository at this point in the history
feat: add Modbus support
  • Loading branch information
proddy authored Jul 3, 2024
2 parents 217d906 + 0c76a24 commit 9277efd
Show file tree
Hide file tree
Showing 71 changed files with 8,941 additions and 12 deletions.
3 changes: 2 additions & 1 deletion interface/src/i18n/de/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const de: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Modbus aktivieren'
};

export default de;
3 changes: 2 additions & 1 deletion interface/src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const en: Translation = {
MODULES_UPDATED: 'Modules updated',
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules',
MODULES_NONE: 'No external modules detected',
RENAME: 'Rename'
RENAME: 'Rename',
ENABLE_MODBUS: 'Enable Modbus'
};

export default en;
3 changes: 2 additions & 1 deletion interface/src/i18n/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const fr: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Activer Modbus'
};

export default fr;
3 changes: 2 additions & 1 deletion interface/src/i18n/it/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const it: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Abilita Modbus'
};

export default it;
3 changes: 2 additions & 1 deletion interface/src/i18n/nl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const nl: Translation = {
MODULES_UPDATED: 'Modules geüpdatet',
MODULES_DESCRIPTION: 'Klik op de module om EMS-ESP library modules te activeren of te deactiveren',
MODULES_NONE: 'Geen externe modules gedetecteerd',
RENAME: 'Hernoemen'
RENAME: 'Hernoemen',
ENABLE_MODBUS: 'Activeer Modbus'
};

export default nl;
3 changes: 2 additions & 1 deletion interface/src/i18n/no/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const no: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Aktiver Modbus'
};

export default no;
3 changes: 2 additions & 1 deletion interface/src/i18n/pl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const pl: BaseTranslation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Aktywuj Modbus'
};

export default pl;
4 changes: 3 additions & 1 deletion interface/src/i18n/sk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ const sk: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Povoliť Modbus'
};

export default sk;
3 changes: 2 additions & 1 deletion interface/src/i18n/sv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const sv: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Aktivera Modbus'
};

export default sv;
3 changes: 2 additions & 1 deletion interface/src/i18n/tr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ const tr: Translation = {
MODULES_UPDATED: 'Modules updated', // TODO translate
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate
MODULES_NONE: 'No external modules detected', // TODO translate
RENAME: 'Rename' // TODO translate
RENAME: 'Rename', // TODO translate
ENABLE_MODBUS: 'Enable Modbus' // TODO translate
};

export default tr;
69 changes: 69 additions & 0 deletions interface/src/project/ApplicationSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,75 @@ const ApplicationSettings: FC = () => {
</Grid>
</Grid>
)}
<Typography sx={{ pt: 2 }} variant="h6" color="primary">
Modbus
</Typography>
<BlockFormControlLabel
control={
<Checkbox
checked={data.modbus_enabled}
onChange={updateFormValue}
name="modbus_enabled"
disabled={saving}
/>
}
label={LL.ENABLE_MODBUS()}
/>
{data.modbus_enabled && (
<Grid
container
spacing={1}
direction="row"
justifyContent="flex-start"
alignItems="flex-start"
>
<Grid item xs={12} sm={6}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="modbus_max_clients"
label={LL.AP_MAX_CLIENTS()}
fullWidth
variant="outlined"
value={numberValue(data.modbus_max_clients)}
type="number"
onChange={updateFormValue}
margin="normal"
disabled={saving}
/>
</Grid>
<Grid item xs={12} sm={6}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="modbus_port"
label="Port"
fullWidth
variant="outlined"
value={numberValue(data.modbus_port)}
type="number"
onChange={updateFormValue}
margin="normal"
disabled={saving}
/>
</Grid>
<Grid item xs={12} sm={6}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="modbus_timeout"
label="Timeout"
InputProps={{
endAdornment: <InputAdornment position="end">ms</InputAdornment>
}}
fullWidth
variant="outlined"
value={numberValue(data.modbus_timeout)}
type="number"
onChange={updateFormValue}
margin="normal"
disabled={saving}
/>
</Grid>
</Grid>
)}
{restartNeeded && (
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
Expand Down
4 changes: 4 additions & 0 deletions interface/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export interface Settings {
eth_phy_addr: number;
eth_clock_mode: number;
platform: string;
modbus_enabled: boolean;
modbus_port: number;
modbus_max_clients: number;
modbus_timeout: number;
}

export enum busConnectionStatus {
Expand Down
26 changes: 26 additions & 0 deletions lib/eModbus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

<img src=https://github.com/eModbus/eModbus/blob/master/eModbusLogo.png width="33%" alt="eModbus">

**Read the docs at http://emodbus.github.io!**

![eModbus](https://github.com/eModbus/eModbus/workflows/Building/badge.svg)

This is a library to provide Modbus client (formerly known as master), server (formerly slave) and bridge/gateway functionalities for Modbus RTU, ASCII and TCP protocols.

For Modbus protocol specifications, please refer to the [Modbus.org site](https://www.modbus.org/specs.php)!

Modbus communication is done in separate tasks, so Modbus requests and responses are non-blocking. Callbacks are provided to prepare or receive the responses asynchronously.

Key features:
- for use in the Arduino framework
- designed for ESP32, various interfaces supported; async versions run also on ESP8266
- non blocking / asynchronous API
- server, client and bridge modes
- TCP (Ethernet, WiFi and Async), ASCII and RTU interfaces
- all common and user-defined Modbus standard function codes

This has been developed by enthusiasts. While we do our utmost best to make robust software, do not expect any bullet-proof, industry deployable, guaranteed software. [**See the license**](https://github.com/eModbus/eModbus/blob/master/license.md) to learn about liabilities etc.

We do welcome any ideas, suggestions, bug reports or questions. Please use the "[Issues](https://github.com/eModbus/eModbus/issues)" tab to report bugs and request new features and visit the "[Discussions](https://github.com/eModbus/eModbus/discussions)" tab for all else.

Have fun!
Loading

0 comments on commit 9277efd

Please sign in to comment.