mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
@@ -129,12 +129,7 @@ const SignIn: FC = () => {
|
||||
<PLflag style={{ width: 24 }} />
|
||||
PL
|
||||
</Button>
|
||||
<Button
|
||||
disabled
|
||||
size="small"
|
||||
variant={locale === 'no' ? 'contained' : 'outlined'}
|
||||
onClick={() => selectLocale('no')}
|
||||
>
|
||||
<Button size="small" variant={locale === 'no' ? 'contained' : 'outlined'} onClick={() => selectLocale('no')}>
|
||||
<NOflag style={{ width: 24 }} />
|
||||
NO
|
||||
</Button>
|
||||
|
||||
@@ -93,7 +93,7 @@ const LayoutAuthMenu: FC = () => {
|
||||
<PLflag style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
PL
|
||||
</MenuItem>
|
||||
<MenuItem key="no" value="no" disabled>
|
||||
<MenuItem key="no" value="no">
|
||||
<NOflag style={{ width: 16, verticalAlign: 'middle' }} />
|
||||
NO
|
||||
</MenuItem>
|
||||
|
||||
@@ -1,270 +1,269 @@
|
||||
import type { BaseTranslation } from '../i18n-types';
|
||||
|
||||
const no: BaseTranslation = {
|
||||
LANGUAGE: 'Language',
|
||||
RETRY: 'Retry',
|
||||
LOADING: 'Loading',
|
||||
IS_REQUIRED: 'is required',
|
||||
SIGN_IN: 'Sign In',
|
||||
SIGN_OUT: 'Sign Out',
|
||||
USERNAME: 'Username',
|
||||
PASSWORD: 'Password',
|
||||
LANGUAGE: 'Språk',
|
||||
RETRY: 'Forsøk igjen',
|
||||
LOADING: 'Laster',
|
||||
IS_REQUIRED: 'er nødvendig',
|
||||
SIGN_IN: 'Logg inn',
|
||||
SIGN_OUT: 'Logg ut',
|
||||
USERNAME: 'Brukernavn',
|
||||
PASSWORD: 'Passord',
|
||||
DASHBOARD: 'Dashboard',
|
||||
SETTINGS: 'Settings',
|
||||
SAVED: 'saved',
|
||||
HELP: 'Help',
|
||||
LOGGED_IN: 'Logged in as {name}',
|
||||
PLEASE_SIGNIN: 'Please sign in to continue',
|
||||
UPLOAD_SUCCESSFUL: 'Upload successful',
|
||||
DOWNLOAD_SUCCESSFUL: 'Download successful',
|
||||
INVALID_LOGIN: 'Invalid login details',
|
||||
NETWORK: 'Network',
|
||||
SECURITY: 'Security',
|
||||
ONOFF_CAP: 'ON/OFF',
|
||||
ONOFF: 'on/off',
|
||||
SETTINGS: 'Innstillinger',
|
||||
SAVED: 'lagret',
|
||||
HELP: 'Hjelp',
|
||||
LOGGED_IN: 'Logget in som {name}',
|
||||
PLEASE_SIGNIN: 'Venligst logge inn for å fortsetta',
|
||||
UPLOAD_SUCCESSFUL: 'Opplasting lykkes',
|
||||
DOWNLOAD_SUCCESSFUL: 'Nedlasting lykkes',
|
||||
INVALID_LOGIN: 'Ugyldig innlogging',
|
||||
NETWORK: 'Nettverk',
|
||||
SECURITY: 'Sikkerhet',
|
||||
ONOFF_CAP: 'PÅ/AV',
|
||||
ONOFF: 'på/av',
|
||||
TYPE: 'Type',
|
||||
DESCRIPTION: 'Description',
|
||||
ENTITIES: 'Entities',
|
||||
REFRESH: 'Refresh',
|
||||
EXPORT: 'Export',
|
||||
DEVICE_DETAILS: 'Device Details',
|
||||
BRAND: 'Brand',
|
||||
ENTITY_NAME: 'Entity Name',
|
||||
VALUE: 'Value',
|
||||
SHOW_FAV: 'only show favorites',
|
||||
DEVICE_SENSOR_DATA: 'Device and Sensor Data',
|
||||
DEVICES_SENSORS: 'Devices & Sensors',
|
||||
ATTACHED_SENSORS: 'Attached EMS-ESP Sensors',
|
||||
RUN_COMMAND: 'Call Command',
|
||||
CHANGE_VALUE: 'Change Value',
|
||||
CANCEL: 'Cancel',
|
||||
RESET: 'Reset',
|
||||
DESCRIPTION: 'Beskrivelse',
|
||||
ENTITIES: 'Ojekter',
|
||||
REFRESH: 'Oppdater',
|
||||
EXPORT: 'Eksport',
|
||||
DEVICE_DETAILS: 'Enhetsdetaljer',
|
||||
BRAND: 'Fabrikat',
|
||||
ENTITY_NAME: 'Objektsnavn',
|
||||
VALUE: 'Verdi',
|
||||
SHOW_FAV: ' Vis kun favoritter',
|
||||
DEVICE_SENSOR_DATA: 'Enheter og Sensordata',
|
||||
DEVICES_SENSORS: 'Enheter og Sensorer',
|
||||
ATTACHED_SENSORS: 'Tilkoblede EMS-ESP Sensorer',
|
||||
RUN_COMMAND: 'Kjør kommando',
|
||||
CHANGE_VALUE: 'Endre Verdi',
|
||||
CANCEL: 'Avbryt',
|
||||
RESET: 'Nullstill',
|
||||
SEND: 'Send',
|
||||
SAVE: 'Save',
|
||||
REMOVE: 'Remove',
|
||||
PROBLEM_UPDATING: 'Problem updating',
|
||||
PROBLEM_LOADING: 'Problem loading',
|
||||
ACCESS_DENIED: 'Access Denied',
|
||||
SAVE: 'Lagre',
|
||||
REMOVE: 'Fjern',
|
||||
PROBLEM_UPDATING: 'Problem med oppdatering',
|
||||
PROBLEM_LOADING: 'Problem med opplasting',
|
||||
ACCESS_DENIED: 'Tilgang nektet',
|
||||
ANALOG_SENSOR: 'Analog Sensor',
|
||||
ANALOG_SENSORS: 'Analog Sensors',
|
||||
UPDATED: 'Updated',
|
||||
UPDATE: 'Update',
|
||||
REMOVED: 'Removed',
|
||||
DELETION: 'Deletion',
|
||||
OFFSET: 'Offset',
|
||||
FACTOR: 'Factor',
|
||||
FREQ: 'Frequency',
|
||||
STARTVALUE: 'Start value',
|
||||
WARN_GPIO: 'Warning: be careful when assigning a GPIO!',
|
||||
EDIT: 'Edit',
|
||||
TEMP_SENSOR: 'Temperature Sensor',
|
||||
TEMP_SENSORS: 'Temperature Sensors',
|
||||
WRITE_COMMAND: 'Write command {cmd}',
|
||||
ANALOG_SENSORS: 'Analoge Sensorer',
|
||||
UPDATED: 'Oppdatert',
|
||||
UPDATE: 'Oppdater',
|
||||
REMOVED: 'Slettet',
|
||||
DELETION: 'Sletting',
|
||||
OFFSET: 'Kompensering',
|
||||
FACTOR: 'Faktor',
|
||||
FREQ: 'Frekvens',
|
||||
STARTVALUE: 'Startverdi',
|
||||
WARN_GPIO: 'Advarsel: vær forsiktig ved aktivering av GPIO!',
|
||||
EDIT: 'Endre',
|
||||
TEMP_SENSOR: 'Temperatursensor',
|
||||
TEMP_SENSORS: 'Temperaturesensorer',
|
||||
WRITE_COMMAND: 'Skriv kommando {cmd}',
|
||||
EMS_BUS_WARNING:
|
||||
'EMS bus disconnected. If this warning still persists after a few seconds please check settings and board profile',
|
||||
EMS_BUS_SCANNING: 'Scanning for EMS devices...',
|
||||
CONNECTED: 'Connected',
|
||||
TX_ISSUES: 'Tx issues - try a different Tx Mode',
|
||||
DISCONNECTED: 'Disconnected',
|
||||
EMS_SCAN: 'Are you sure you want to initiate a full device scan of the EMS bus?',
|
||||
EMS_BUS_STATUS: 'EMS Bus Status',
|
||||
ACTIVE_DEVICES: 'Active Devices & Sensors',
|
||||
DEVICE: 'Device',
|
||||
SUCCESS: 'SUCCESS',
|
||||
FAIL: 'FAIL',
|
||||
QUALITY: 'QUALITY',
|
||||
SCAN_DEVICES: 'Scan for new devices',
|
||||
EMS_BUS_STATUS_TITLE: 'EMS Bus & Activity Status',
|
||||
SCAN: 'Scan',
|
||||
'EMS bussen koblet ned. Hvis denne advarselen fortsetter etter noen f¨sekunder sjekk instillinger og prosessorkort',
|
||||
EMS_BUS_SCANNING: 'Søker etter EMS enheter...',
|
||||
CONNECTED: 'Tilkoblet',
|
||||
TX_ISSUES: 'Tx problemer - prøv en annen Tx Modus',
|
||||
DISCONNECTED: 'Frakoblet',
|
||||
EMS_SCAN: 'Er du sikker på du vil starte full søking av EMS bussen?',
|
||||
EMS_BUS_STATUS: 'EMS Buss Status',
|
||||
ACTIVE_DEVICES: 'Aktive Enheter og Sensorer',
|
||||
DEVICE: 'Enhet',
|
||||
SUCCESS: 'VELLYKKET',
|
||||
FAIL: 'MISLYKKET',
|
||||
QUALITY: 'KVALITET',
|
||||
SCAN_DEVICES: 'Søk etter nye enheter',
|
||||
EMS_BUS_STATUS_TITLE: 'EMS Buss & Aktivitet Status',
|
||||
SCAN: 'Søk',
|
||||
STATUS_NAMES: [
|
||||
'EMS Telegrams Received (Rx)',
|
||||
'EMS Reads (Tx)',
|
||||
'EMS Writes (Tx)',
|
||||
'Temperature Sensor Reads',
|
||||
'Analog Sensor Reads',
|
||||
'MQTT Publishes',
|
||||
'API Calls',
|
||||
'Syslog Messages'
|
||||
'EMS Telegrammer Mottatt (Rx)',
|
||||
'EMS Lest (Tx)',
|
||||
'EMS Skrevet (Tx)',
|
||||
'Temperatur Sensor Lest',
|
||||
'Analog Sensor Lest',
|
||||
'MQTT Publiseringer',
|
||||
'API Anrop',
|
||||
'Syslog Meldinger'
|
||||
],
|
||||
NUM_DEVICES: '{num} Device{{s}}',
|
||||
NUM_TEMP_SENSORS: '{num} Temperature Sensor{{s}}',
|
||||
NUM_ANALOG_SENSORS: '{num} Analog Sensor{{s}}',
|
||||
NUM_DAYS: '{num} Day{{s}}',
|
||||
NUM_SECONDS: '{num} Second{{s}}',
|
||||
NUM_HOURS: '{num} Hour{{s}}',
|
||||
NUM_MINUTES: '{num} Minute{{s}}',
|
||||
APPLICATION_SETTINGS: 'Application Settings',
|
||||
CUSTOMIZATION: 'Customization',
|
||||
APPLICATION_RESTARTING: 'EMS-ESP is restarting',
|
||||
NUM_DEVICES: '{num} Enhet{{er}}',
|
||||
NUM_TEMP_SENSORS: '{num} Temperatursensor{{er}}',
|
||||
NUM_ANALOG_SENSORS: '{num} Analogsensor{{er}}',
|
||||
NUM_DAYS: '{num} Dag{{er}}',
|
||||
NUM_SECONDS: '{num} Sekund{{er}}',
|
||||
NUM_HOURS: '{num} Time{{r}}',
|
||||
NUM_MINUTES: '{num} Minutt{{er}}',
|
||||
APPLICATION_SETTINGS: 'Innstillinger',
|
||||
CUSTOMIZATION: 'Tilpasninger',
|
||||
APPLICATION_RESTARTING: 'EMS-ESP restarter',
|
||||
BOARD_PROFILE_TEXT:
|
||||
'Select a pre-configured interface board profile from the list below or choose Custom to configure your own hardware settings',
|
||||
BOARD_PROFILE: 'Board Profile',
|
||||
BUTTON: 'Button',
|
||||
TEMPERATURE: 'Temperature',
|
||||
DISABLED: 'disabled',
|
||||
GENERAL_OPTIONS: 'General Options',
|
||||
LANGUAGE_ENTITIES: 'Language (for device entities)',
|
||||
HIDE_LED: 'Hide LED',
|
||||
ENABLE_TELNET: 'Enable Telnet Console',
|
||||
ENABLE_ANALOG: 'Enable Analog Sensors',
|
||||
CONVERT_FAHRENHEIT: 'Convert temperature values to Fahrenheit',
|
||||
BYPASS_TOKEN: 'Bypass Access Token authorization on API calls',
|
||||
READONLY: 'Enable read-only mode (blocks all outgoing EMS Tx Write commands)',
|
||||
UNDERCLOCK_CPU: 'Underclock CPU speed',
|
||||
ENABLE_SHOWER_TIMER: 'Enable Shower Timer',
|
||||
ENABLE_SHOWER_ALERT: 'Enable Shower Alert',
|
||||
TRIGGER_TIME: 'Trigger Time',
|
||||
COLD_SHOT_DURATION: 'Cold Shot Duration',
|
||||
FORMATTING_OPTIONS: 'Formatting Options',
|
||||
BOOLEAN_FORMAT_DASHBOARD: 'Boolean Format Dashboard',
|
||||
BOOLEAN_FORMAT_API: 'Boolean Format API/MQTT',
|
||||
'Velg en pre-konfigurert prosessor profil fra listen under eller velg Tilpasset for å konfigurere dine egne innstillinger',
|
||||
BOARD_PROFILE: 'Prosessor Profil',
|
||||
BUTTON: 'Knapp',
|
||||
TEMPERATURE: 'Temperatur',
|
||||
DISABLED: 'avslått',
|
||||
GENERAL_OPTIONS: 'Generelle Innstillinger',
|
||||
LANGUAGE_ENTITIES: 'Språk (for objekter)',
|
||||
HIDE_LED: 'Skjul LED',
|
||||
ENABLE_TELNET: 'Aktiver Telnet',
|
||||
ENABLE_ANALOG: 'Aktiver Analoge Sensorer',
|
||||
CONVERT_FAHRENHEIT: 'Konverter temperatur til Fahrenheit',
|
||||
BYPASS_TOKEN: 'Utelat Aksess Token authorisering av API kall',
|
||||
READONLY: 'Aktiver read-only modus (blokker all EMS Tx Skriving)',
|
||||
UNDERCLOCK_CPU: 'Underklokking av prosessorhastighet',
|
||||
ENABLE_SHOWER_TIMER: 'Aktiver Dusjtimer',
|
||||
ENABLE_SHOWER_ALERT: 'Aktiver Dusj-varsling',
|
||||
TRIGGER_TIME: 'Aktiveringstid',
|
||||
COLD_SHOT_DURATION: 'Tid på kaldt vann',
|
||||
FORMATTING_OPTIONS: 'Formatteringsalternativs',
|
||||
BOOLEAN_FORMAT_DASHBOARD: 'Bool Format Dashboard',
|
||||
BOOLEAN_FORMAT_API: 'Bool Format API/MQTT',
|
||||
ENUM_FORMAT: 'Enum Format API/MQTT',
|
||||
INDEX: 'Index',
|
||||
ENABLE_PARASITE: 'Enable parasite power',
|
||||
INDEX: 'Indeks',
|
||||
ENABLE_PARASITE: 'Aktiver parasitt strømforsyning',
|
||||
LOGGING: 'Logging',
|
||||
LOG_HEX: 'Log EMS telegrams in hexadecimal',
|
||||
ENABLE_SYSLOG: 'Enable Syslog',
|
||||
MARK_INTERVAL: 'Mark Interval',
|
||||
SECONDS: 'seconds',
|
||||
MINUTES: 'minutes',
|
||||
RESTART: 'Restart',
|
||||
HOURS: 'hours',
|
||||
RESTART_TEXT: 'EMS-ESP needs to be restarted to apply changed system settings',
|
||||
RESTART_CONFIRM: 'Are you sure you want to restart EMS-ESP?',
|
||||
COMMAND: 'Command',
|
||||
CUSTOMIZATIONS_RESTART: 'All customizations have been removed. Restarting...',
|
||||
CUSTOMIZATIONS_FULL: 'Selected entities exceeded limit. Please save in batches',
|
||||
CUSTOMIZATIONS_SAVED: 'Customizations saved',
|
||||
CUSTOMIZATIONS_HELP_1: 'Select a device and customize the entities options or click to rename',
|
||||
CUSTOMIZATIONS_HELP_2: 'mark as favorite',
|
||||
CUSTOMIZATIONS_HELP_3: 'disable write action',
|
||||
CUSTOMIZATIONS_HELP_4: 'exclude from MQTT and API',
|
||||
CUSTOMIZATIONS_HELP_5: 'hide from Dashboard',
|
||||
SELECT_DEVICE: 'Select a device',
|
||||
SET_ALL: 'set all',
|
||||
OPTIONS: 'Options',
|
||||
NAME: 'Name',
|
||||
LOG_HEX: 'Logg EMS telegrammer i hexadesimal',
|
||||
ENABLE_SYSLOG: 'Aktiver Syslog',
|
||||
MARK_INTERVAL: 'Oppdateringsintervall',
|
||||
SECONDS: 'sekunder',
|
||||
MINUTES: 'minutter',
|
||||
RESTART: 'Omstart',
|
||||
HOURS: 'timer',
|
||||
RESTART_TEXT: 'EMS-ESP må omstartes for å iverksette endrede systeminstillinger',
|
||||
RESTART_CONFIRM: 'Er du sikker på at du vil omstarte EMS-ESP?',
|
||||
COMMAND: 'Kommando',
|
||||
CUSTOMIZATIONS_RESTART: 'Alle tilpasninger har blitt slettet. Restarter...',
|
||||
CUSTOMIZATIONS_FULL: 'Antall valgte objekter for høyt. Largre i mindre antall om gangen',
|
||||
CUSTOMIZATIONS_SAVED: 'Tilpasninger lagret',
|
||||
CUSTOMIZATIONS_HELP_1: 'Velg en enhet og tilpass underenheter med hjelp av alternativer eller velg å gi nytt navn',
|
||||
CUSTOMIZATIONS_HELP_2: 'merk som favoritt',
|
||||
CUSTOMIZATIONS_HELP_3: 'inaktiviser skriving',
|
||||
CUSTOMIZATIONS_HELP_4: 'ekskludere fra MQTT og API',
|
||||
CUSTOMIZATIONS_HELP_5: 'gjemme fra Dashboard',
|
||||
SELECT_DEVICE: 'Velg en enhet',
|
||||
SET_ALL: 'sett alle',
|
||||
OPTIONS: 'Alternativ',
|
||||
NAME: 'Navn',
|
||||
CUSTOMIZATIONS_RESET:
|
||||
'Are you sure you want remove all customizations including the custom settings of the Temperature and Analog sensors?',
|
||||
DEVICE_ENTITIES: 'Device Entities',
|
||||
USER_CUSTOMIZATION: 'User Customization',
|
||||
SUPPORT_INFORMATION: 'Support Information',
|
||||
CLICK_HERE: 'Click Here',
|
||||
HELP_INFORMATION_1: 'Visit the online wiki to get instructions on how to configure EMS-ESP',
|
||||
HELP_INFORMATION_2: 'For live community chat join our Discord server',
|
||||
HELP_INFORMATION_3: 'To request a feature or report a bug',
|
||||
'Er du sikker på att du vil fjerne tilpassninger inkludert innstillinger for Temperatur og Analoge sensorer?',
|
||||
DEVICE_ENTITIES: 'Enhets objekter',
|
||||
USER_CUSTOMIZATION: 'Brukertilpasninger',
|
||||
SUPPORT_INFORMATION: 'Supportinformasjon',
|
||||
CLICK_HERE: 'Klikk her',
|
||||
HELP_INFORMATION_1: 'Besøk wiki for instruksjoner for å konfigurere EMS-ESP',
|
||||
HELP_INFORMATION_2: 'For community-support besøk vår Discord-server',
|
||||
HELP_INFORMATION_3: 'For å be om en ny funksjon eller melde feil',
|
||||
HELP_INFORMATION_4:
|
||||
'remember to download and attach your system information for a faster response when reporting an issue',
|
||||
HELP_INFORMATION_5:
|
||||
'EMS-ESP is a free and open-source project. Please support its future development by giving it a star on Github!',
|
||||
SUPPORT_INFO: 'Support Info',
|
||||
UPLOAD: 'Upload',
|
||||
DOWNLOAD: 'Download',
|
||||
ABORTED: 'aborted',
|
||||
FAILED: 'failed',
|
||||
SUCCESSFUL: 'successful',
|
||||
'husk å laste ned og legg ved din systeminformasjon for en raskere respons når du rapporterer et problem',
|
||||
HELP_INFORMATION_5: 'EMS-ESP er gratis og åpen kildekode. Bidra til utviklingen ved å gi oss en stjerne på GitHub!',
|
||||
SUPPORT_INFO: 'Supportinfo',
|
||||
UPLOAD: 'Opplasning',
|
||||
DOWNLOAD: 'Nedlasting',
|
||||
ABORTED: 'avbrutt',
|
||||
FAILED: 'feilet',
|
||||
SUCCESSFUL: 'vellykket',
|
||||
SYSTEM: 'System',
|
||||
LOG: 'Log',
|
||||
LOG: 'Logg',
|
||||
STATUS: 'Status',
|
||||
UPLOAD_DOWNLOAD: 'Upload/Download',
|
||||
SYSTEM_VERSION_RUNNING: 'You are currently running version',
|
||||
SYSTEM_APPLY_FIRMWARE: 'to apply the new firmware',
|
||||
CLOSE: 'Close',
|
||||
USE: 'Use',
|
||||
FACTORY_RESET: 'Factory Reset',
|
||||
SYSTEM_FACTORY_TEXT: 'Device has been factory reset and will now restart',
|
||||
SYSTEM_FACTORY_TEXT_DIALOG: 'Are you sure you want to reset the device to its factory defaults?',
|
||||
VERSION_CHECK: 'Version Check',
|
||||
THE_LATEST: 'The latest',
|
||||
VERSION_IS: 'version is',
|
||||
PLATFORM: 'Device (Platform / SDK)',
|
||||
UPTIME: 'System Uptime',
|
||||
CPU_FREQ: 'CPU Frequency',
|
||||
HEAP: 'Heap (Free / Max Alloc)',
|
||||
PSRAM: 'PSRAM (Size / Free)',
|
||||
FLASH: 'Flash Chip (Size / Speed)',
|
||||
APPSIZE: 'Application (Used / Free)',
|
||||
FILESYSTEM: 'File System (Used / Free)',
|
||||
BUFFER_SIZE: 'Buffer Size',
|
||||
COMPACT: 'Compact',
|
||||
ENABLE_OTA: 'Enable OTA Updates',
|
||||
DOWNLOAD_CUSTOMIZATION_TEXT: 'Download the entity customizations',
|
||||
UPLOAD_DOWNLOAD: 'Opp/Nedlasting',
|
||||
SYSTEM_VERSION_RUNNING: 'Du benytter versjon',
|
||||
SYSTEM_APPLY_FIRMWARE: 'for å aktivere ny firmware',
|
||||
CLOSE: 'Steng',
|
||||
USE: 'Bruk',
|
||||
FACTORY_RESET: 'Sett tilbake til fabrikkinstilling',
|
||||
SYSTEM_FACTORY_TEXT: 'Enhet har blitt satt tilbake til fabrikkinstilling og vil restarte',
|
||||
SYSTEM_FACTORY_TEXT_DIALOG: 'Er du sikker på at du vil resette enheten til fabrikkinstillinger?',
|
||||
VERSION_CHECK: 'Versjonsjekk',
|
||||
THE_LATEST: 'Den nyeste',
|
||||
VERSION_IS: 'versjonen er',
|
||||
PLATFORM: 'Enhet (Platform / SDK)',
|
||||
UPTIME: 'System Oppetid',
|
||||
CPU_FREQ: 'CPU Frekvens',
|
||||
HEAP: 'Heap (Ledig / Max Allokert)',
|
||||
PSRAM: 'PSRAM (Størrelse / Ledig)',
|
||||
FLASH: 'Flash Chip (Størrelse / Hastighet)',
|
||||
APPSIZE: 'Applikasjon (Brukt / Ledig)',
|
||||
FILESYSTEM: 'File System (Brukt / Ledig)',
|
||||
BUFFER_SIZE: 'Buffer Størrelse',
|
||||
COMPACT: 'Komprimere',
|
||||
ENABLE_OTA: 'Aktiviser OTA oppdateringer',
|
||||
DOWNLOAD_CUSTOMIZATION_TEXT: 'Last ned objektstilpasninger',
|
||||
DOWNLOAD_SETTINGS_TEXT:
|
||||
'Download the application settings. Be careful when sharing your settings as this file contains passwords and other sensitive system information',
|
||||
UPLOAD_TEXT: 'Upload a new firmware (.bin) file, settings or customizations (.json) file below',
|
||||
UPLOADING: 'Uploading',
|
||||
UPLOAD_DROP_TEXT: 'Drop file or click here',
|
||||
ERROR: 'Unexpected Error, please try again',
|
||||
TIME_SET: 'Time set',
|
||||
MANAGE_USERS: 'Manage Users',
|
||||
IS_ADMIN: 'is Admin',
|
||||
USER_WARNING: 'You must have at least one admin user configured',
|
||||
ADD: 'Add',
|
||||
ACCESS_TOKEN_FOR: 'Access Token for',
|
||||
'Last ned applikasjonskonfigurasjon. Vær varsom med å dele fila da den inneholder passord og annen sensitiv system informasjon',
|
||||
UPLOAD_TEXT: 'Last opp en ny firmware (.bin) fil, innstillinger eller tilpassninger (.json) fil nedenfor',
|
||||
UPLOADING: 'Opplasting',
|
||||
UPLOAD_DROP_TEXT: 'Slipp fil eller klikk her',
|
||||
ERROR: 'Ukjent feil, prøv igjen',
|
||||
TIME_SET: 'Still in tid',
|
||||
MANAGE_USERS: 'Administrer Brukere',
|
||||
IS_ADMIN: 'er Admin',
|
||||
USER_WARNING: 'Du må ha minst en admin bruker konfigurert',
|
||||
ADD: 'Legg til',
|
||||
ACCESS_TOKEN_FOR: 'Aksess Token for',
|
||||
ACCESS_TOKEN_TEXT:
|
||||
'The token below is used with REST API calls that require authorization. It can be passed either as a Bearer token in the Authorization header or in the access_token URL query parameter.',
|
||||
GENERATING_TOKEN: 'Generating token',
|
||||
USER: 'User',
|
||||
MODIFY: 'Modify',
|
||||
'Token nedenfor benyttes med REST API-kall som krever autorisering. Den kan sendes med enten som en Bearer token i Authorization-headern eller i access_token URL query-parameter.',
|
||||
GENERATING_TOKEN: 'Generer token',
|
||||
USER: 'Bruker',
|
||||
MODIFY: 'Endre',
|
||||
SU_TEXT:
|
||||
'The su (super user) password is used to sign authentication tokens and also enable admin privileges within the Console.',
|
||||
NOT_ENABLED: 'Not enabled',
|
||||
ERRORS: 'Errors',
|
||||
DISCONNECT_REASON: 'Disconnect Reason',
|
||||
ENABLE_MQTT: 'Enable MQTT',
|
||||
OPTIONAL: 'Optional',
|
||||
FORMATTING: 'Formatting',
|
||||
'su brukeren (super user) passord benyttes for å signere autentiserings token samt å tillate admin privileger i konsoll modus.',
|
||||
NOT_ENABLED: 'Ikke aktiv',
|
||||
ERRORS: 'Feil',
|
||||
DISCONNECT_REASON: 'Årsak til nedkobling',
|
||||
ENABLE_MQTT: 'Aktiver MQTT',
|
||||
OPTIONAL: 'Valgfritt',
|
||||
FORMATTING: 'Formatering',
|
||||
FORMAT: 'Format',
|
||||
MQTT_NEST_1: 'Nested in a single topic',
|
||||
MQTT_NEST_2: 'As individual topics',
|
||||
MQTT_RESPONSE: 'Publish command output to a `response` topic',
|
||||
MQTT_PUBLISH_TEXT_1: 'Publish single value topics on change',
|
||||
MQTT_PUBLISH_TEXT_2: 'Publish to command topics (ioBroker)',
|
||||
MQTT_PUBLISH_TEXT_3: 'Enable MQTT Discovery (Home Assistant, Domoticz)',
|
||||
MQTT_PUBLISH_TEXT_4: 'Prefix for the Discovery topics',
|
||||
MQTT_PUBLISH_INTERVALS: 'Publish Intervals',
|
||||
MQTT_INT_BOILER: 'Boilers and Heat Pumps',
|
||||
MQTT_INT_THERMOSTATS: 'Thermostats',
|
||||
MQTT_INT_SOLAR: 'Solar Modules',
|
||||
MQTT_INT_MIXER: 'Mixer Modules',
|
||||
DEFAULT: 'Default',
|
||||
MQTT_CLEAN_SESSION: 'Set Clean Session',
|
||||
MQTT_RETAIN_FLAG: 'Always set Retain flag',
|
||||
INACTIVE: 'Inactive',
|
||||
ACTIVE: 'Active',
|
||||
UNKNOWN: 'Unknown',
|
||||
SET_TIME: 'Set Time',
|
||||
SET_TIME_TEXT: 'Enter local date and time below to set the time',
|
||||
LOCAL_TIME: 'Local Time',
|
||||
UTC_TIME: 'UTC Time',
|
||||
ENABLE_NTP: 'Enable NTP',
|
||||
TIME_ZONE: 'Time Zone',
|
||||
ACCESS_POINT: 'Access Point',
|
||||
AP_PROVIDE: 'Enable Access Point',
|
||||
AP_PROVIDE_TEXT_1: 'always',
|
||||
AP_PROVIDE_TEXT_2: 'when WiFi is disconnected',
|
||||
AP_PROVIDE_TEXT_3: 'never',
|
||||
AP_PREFERRED_CHANNEL: 'Preferred Channel',
|
||||
AP_HIDE_SSID: 'Hide SSID',
|
||||
NETWORK_SCAN: 'Scan WiFi Networks',
|
||||
IDLE: 'Idle',
|
||||
LOST: 'Lost',
|
||||
SCANNING: 'Scanning',
|
||||
SCAN_AGAIN: 'Scan again',
|
||||
NETWORK_SCANNER: 'Network Scanner',
|
||||
NETWORK_NO_WIFI: 'No WiFi networks found',
|
||||
NETWORK_BLANK_SSID: 'leave blank to disable WiFi',
|
||||
POWER: 'Power',
|
||||
NETWORK_DISABLE_SLEEP: 'Disable WiFi Sleep Mode',
|
||||
NETWORK_LOW_BAND: 'Use Lower WiFi Bandwidth',
|
||||
NETWORK_USE_DNS: 'Enable mDNS Service',
|
||||
NETWORK_ENABLE_IPV6: 'Enable IPv6 support',
|
||||
NETWORK_FIXED_IP: 'Use Fixed IP address',
|
||||
MQTT_NEST_1: 'Nestet i en topic',
|
||||
MQTT_NEST_2: 'Som individuelle topics',
|
||||
MQTT_RESPONSE: 'Publiser kommandoer til en `response` topic',
|
||||
MQTT_PUBLISH_TEXT_1: 'Publiser singel verdi topics ved endringer',
|
||||
MQTT_PUBLISH_TEXT_2: 'Publiser til kommando topics (ioBroker)',
|
||||
MQTT_PUBLISH_TEXT_3: 'Aktiver MQTT Discovery (Home Assistant, Domoticz)',
|
||||
MQTT_PUBLISH_TEXT_4: 'Prefiks for Discovery topics',
|
||||
MQTT_PUBLISH_INTERVALS: 'Publiseringsintervall',
|
||||
MQTT_INT_BOILER: 'Fyr/Varmepumpe',
|
||||
MQTT_INT_THERMOSTATS: 'Termostat',
|
||||
MQTT_INT_SOLAR: 'Solpaneler',
|
||||
MQTT_INT_MIXER: 'Blandeventil',
|
||||
DEFAULT: 'Standard',
|
||||
MQTT_CLEAN_SESSION: 'Benytt Clean Session',
|
||||
MQTT_RETAIN_FLAG: 'Alltid sett Retain flag',
|
||||
INACTIVE: 'Innaktiv',
|
||||
ACTIVE: 'Aktiv',
|
||||
UNKNOWN: 'Ukjent',
|
||||
SET_TIME: 'Sett Tid',
|
||||
SET_TIME_TEXT: 'Skriv inn dato og klokke nedenfor',
|
||||
LOCAL_TIME: 'Lokaltid',
|
||||
UTC_TIME: 'UTC Tid',
|
||||
ENABLE_NTP: 'Aktiver NTP',
|
||||
TIME_ZONE: 'Tidssone',
|
||||
ACCESS_POINT: 'Aksesspunkt',
|
||||
AP_PROVIDE: 'Aktiver Aksesspunkt',
|
||||
AP_PROVIDE_TEXT_1: 'alltid',
|
||||
AP_PROVIDE_TEXT_2: 'når WiFi er utilgjengelig',
|
||||
AP_PROVIDE_TEXT_3: 'aldri',
|
||||
AP_PREFERRED_CHANNEL: 'Foretrukket kanal',
|
||||
AP_HIDE_SSID: 'Skjul SSID',
|
||||
NETWORK_SCAN: 'Søk etter trådløst nettverk',
|
||||
IDLE: 'Klar',
|
||||
LOST: 'Mistet',
|
||||
SCANNING: 'Søker',
|
||||
SCAN_AGAIN: 'Søk igjen',
|
||||
NETWORK_SCANNER: 'Nettverk Scanner',
|
||||
NETWORK_NO_WIFI: 'Ingen trådløse nett funnet',
|
||||
NETWORK_BLANK_SSID: 'la feltet være blankt for å deaktivisere trådløst nettverk',
|
||||
POWER: 'Effekt',
|
||||
NETWORK_DISABLE_SLEEP: 'Hindre at trådløst nettverk går i Sleep Mode',
|
||||
NETWORK_LOW_BAND: 'Benytt smalere båndbredde på trådløst nettverk',
|
||||
NETWORK_USE_DNS: 'Aktiviser mDNS Service',
|
||||
NETWORK_ENABLE_IPV6: 'Aktiviser IPv6 støtte',
|
||||
NETWORK_FIXED_IP: 'Benytt statisk IP adresse',
|
||||
ADMIN: 'Admin',
|
||||
GUEST: 'Guest',
|
||||
NEW: 'New',
|
||||
RENAME: 'Rename',
|
||||
ENTITY: 'Entity'
|
||||
GUEST: 'Gjest',
|
||||
NEW: 'Ny',
|
||||
RENAME: 'Bytt navn',
|
||||
ENTITY: 'Entitet'
|
||||
};
|
||||
|
||||
export default no;
|
||||
|
||||
@@ -425,7 +425,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine
|
||||
|
||||
if (commands.exact.count(longest->first) == 1) {
|
||||
for (auto & name : longest->second->name_) {
|
||||
result.replacement->push_back(std::move((name))); // TODO remove all moves?
|
||||
result.replacement->push_back(name);
|
||||
}
|
||||
|
||||
// Add a space because there are sub-commands for a command that has matched exactly
|
||||
|
||||
@@ -443,7 +443,6 @@ bool SyslogService::transmit(const QueuedLogMessage & message) {
|
||||
udp_.print('-');
|
||||
}
|
||||
|
||||
// TODO should use flash?
|
||||
udp_.printf_P(PSTR(" %s %s - - - "), hostname_.c_str(), (message.content_->name));
|
||||
|
||||
char id_c_str[15];
|
||||
|
||||
@@ -31,7 +31,6 @@ void AnalogSensor::start() {
|
||||
}
|
||||
analogSetAttenuation(ADC_2_5db); // for all channels 1.5V
|
||||
|
||||
|
||||
LOG_INFO("Starting Analog sensor service");
|
||||
|
||||
// Add API call for /info
|
||||
@@ -39,18 +38,18 @@ void AnalogSensor::start() {
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(info),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
||||
F_(info_cmd));
|
||||
FL_(info_cmd));
|
||||
Command::add(
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(setvalue),
|
||||
[&](const char * value, const int8_t id) { return command_setvalue(value, id); },
|
||||
("set io value"), // TODO translate this
|
||||
FL_(setiovalue_cmd),
|
||||
CommandFlag::ADMIN_ONLY);
|
||||
Command::add(
|
||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||
F_(commands),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
||||
F_(commands_cmd));
|
||||
FL_(commands_cmd));
|
||||
|
||||
Mqtt::subscribe(EMSdevice::DeviceType::ANALOGSENSOR, "analogsensor/#", nullptr); // use empty function callback
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * value, const bool is_admin, const int8_t id, JsonObject & output) {
|
||||
uint8_t return_code = CommandRet::OK;
|
||||
|
||||
std::string dname = EMSdevice::device_type_2_device_name(device_type);
|
||||
auto dname = EMSdevice::device_type_2_device_name(device_type);
|
||||
|
||||
// see if there is a command registered
|
||||
auto cf = find_command(device_type, cmd);
|
||||
@@ -248,7 +248,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
if ((device_type > EMSdevice::DeviceType::SYSTEM) && (!value || !strlen(value))) {
|
||||
if (!cf || !cf->cmdfunction_json_) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG("[DEBUG] Calling %s command '%s' to retrieve attributes", dname.c_str(), cmd);
|
||||
LOG_DEBUG("[DEBUG] Calling %s command '%s' to retrieve attributes", dname, cmd);
|
||||
#endif
|
||||
return EMSESP::get_device_value_info(output, cmd, id, device_type) ? CommandRet::OK : CommandRet::ERROR; // entity = cmd
|
||||
}
|
||||
@@ -262,17 +262,19 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
return CommandRet::NOT_ALLOWED; // command not allowed
|
||||
}
|
||||
|
||||
auto description = Helpers::translated_word(cf->description_);
|
||||
|
||||
if ((value == nullptr) || (strlen(value) == 0)) {
|
||||
if (EMSESP::system_.readonly_mode()) {
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_);
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s)"), dname, cmd, description);
|
||||
} else {
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_);
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s)"), dname, cmd, description);
|
||||
}
|
||||
} else {
|
||||
if (EMSESP::system_.readonly_mode()) {
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_, value);
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s) with value %s"), dname, cmd, description, value);
|
||||
} else {
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_, value);
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s) with value %s"), dname, cmd, description, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +301,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
}
|
||||
|
||||
// add a command to the list, which does not return json
|
||||
void Command::add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * description, uint8_t flags) {
|
||||
void Command::add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags) {
|
||||
// if the command already exists for that device type don't add it
|
||||
if (find_command(device_type, cmd) != nullptr) {
|
||||
return;
|
||||
@@ -314,7 +316,7 @@ void Command::add(const uint8_t device_type, const char * cmd, const cmd_functio
|
||||
}
|
||||
|
||||
// add a command to the list, which does return a json object as output
|
||||
void Command::add(const uint8_t device_type, const char * cmd, const cmd_json_function_p cb, const char * description, uint8_t flags) {
|
||||
void Command::add(const uint8_t device_type, const char * cmd, const cmd_json_function_p cb, const char * const * description, uint8_t flags) {
|
||||
// if the command already exists for that device type don't add it
|
||||
if (find_command(device_type, cmd) != nullptr) {
|
||||
return;
|
||||
@@ -348,7 +350,6 @@ Command::CmdFunction * Command::find_command(const uint8_t device_type, const ch
|
||||
|
||||
// list all commands for a specific device, output as json
|
||||
bool Command::list(const uint8_t device_type, JsonObject & output) {
|
||||
|
||||
if (cmdfunctions_.empty()) {
|
||||
output["message"] = "no commands available";
|
||||
return false;
|
||||
@@ -366,7 +367,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) {
|
||||
for (const auto & cl : sorted_cmds) {
|
||||
for (const auto & cf : cmdfunctions_) {
|
||||
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) {
|
||||
output[cl] = cf.description_;
|
||||
output[cl] = Helpers::translated_word(cf.description_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,7 +426,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo
|
||||
shell.print(EMSdevice::tag_to_string(DeviceValueTAG::TAG_DEVICE_DATA_WW));
|
||||
shell.print(' ');
|
||||
}
|
||||
shell.print((cf.description_));
|
||||
shell.print(Helpers::translated_word(cf.description_));
|
||||
if (!cf.has_flags(CommandFlag::ADMIN_ONLY)) {
|
||||
shell.print(' ');
|
||||
shell.print(COLOR_BRIGHT_RED);
|
||||
@@ -475,19 +476,19 @@ bool Command::device_has_commands(const uint8_t device_type) {
|
||||
|
||||
// list sensors and EMS devices
|
||||
void Command::show_devices(uuid::console::Shell & shell) {
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM).c_str());
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM));
|
||||
|
||||
if (EMSESP::dallassensor_.have_sensors()) {
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR).c_str());
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR));
|
||||
}
|
||||
if (EMSESP::analogsensor_.have_sensors()) {
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR).c_str());
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR));
|
||||
}
|
||||
|
||||
for (const auto & device_class : EMSFactory::device_handlers()) {
|
||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||
if (emsdevice && (emsdevice->device_type() == device_class.first) && (device_has_commands(device_class.first))) {
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(device_class.first).c_str());
|
||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(device_class.first));
|
||||
break; // we only want to show one (not multiple of the same device types)
|
||||
}
|
||||
}
|
||||
@@ -503,7 +504,7 @@ void Command::show_all(uuid::console::Shell & shell) {
|
||||
// show system first
|
||||
shell.print(COLOR_BOLD_ON);
|
||||
shell.print(COLOR_YELLOW);
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM).c_str());
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM));
|
||||
shell.print(COLOR_RESET);
|
||||
show(shell, EMSdevice::DeviceType::SYSTEM, true);
|
||||
|
||||
@@ -511,14 +512,14 @@ void Command::show_all(uuid::console::Shell & shell) {
|
||||
if (EMSESP::dallassensor_.have_sensors()) {
|
||||
shell.print(COLOR_BOLD_ON);
|
||||
shell.print(COLOR_YELLOW);
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR).c_str());
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR));
|
||||
shell.print(COLOR_RESET);
|
||||
show(shell, EMSdevice::DeviceType::DALLASSENSOR, true);
|
||||
}
|
||||
if (EMSESP::analogsensor_.have_sensors()) {
|
||||
shell.print(COLOR_BOLD_ON);
|
||||
shell.print(COLOR_YELLOW);
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR).c_str());
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR));
|
||||
shell.print(COLOR_RESET);
|
||||
show(shell, EMSdevice::DeviceType::ANALOGSENSOR, true);
|
||||
}
|
||||
@@ -528,7 +529,7 @@ void Command::show_all(uuid::console::Shell & shell) {
|
||||
if (Command::device_has_commands(device_class.first)) {
|
||||
shell.print(COLOR_BOLD_ON);
|
||||
shell.print(COLOR_YELLOW);
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(device_class.first).c_str());
|
||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(device_class.first));
|
||||
shell.print(COLOR_RESET);
|
||||
show(shell, device_class.first, true);
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ class Command {
|
||||
const char * cmd_;
|
||||
const cmd_function_p cmdfunction_;
|
||||
const cmd_json_function_p cmdfunction_json_;
|
||||
const char * description_;
|
||||
const char * const * description_;
|
||||
|
||||
CmdFunction(const uint8_t device_type,
|
||||
const uint8_t flags,
|
||||
const char * cmd,
|
||||
const cmd_function_p cmdfunction,
|
||||
const cmd_json_function_p cmdfunction_json,
|
||||
const char * description)
|
||||
const char * const * description)
|
||||
: device_type_(device_type)
|
||||
, flags_(flags)
|
||||
, cmd_(cmd)
|
||||
@@ -97,12 +97,18 @@ class Command {
|
||||
static uint8_t call(const uint8_t device_type, const char * cmd, const char * value);
|
||||
|
||||
// with normal call back function taking a value and id
|
||||
static void
|
||||
add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * description, uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||
static void add(const uint8_t device_type,
|
||||
const char * cmd,
|
||||
const cmd_function_p cb,
|
||||
const char * const * description,
|
||||
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||
|
||||
// callback function taking value, id and a json object for its output
|
||||
static void
|
||||
add(const uint8_t device_type, const char * cmd, const cmd_json_function_p cb, const char * description, uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||
static void add(const uint8_t device_type,
|
||||
const char * cmd,
|
||||
const cmd_json_function_p cb,
|
||||
const char * const * description,
|
||||
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_DEFAULT);
|
||||
|
||||
static void show_all(uuid::console::Shell & shell);
|
||||
static Command::CmdFunction * find_command(const uint8_t device_type, const char * cmd);
|
||||
|
||||
@@ -277,15 +277,16 @@ void EMSESPShell::add_console_commands() {
|
||||
[](Shell & shell, const std::vector<std::string> & arguments) {
|
||||
uint16_t watch_id = WATCH_ID_NONE;
|
||||
|
||||
// only use english commands, not the translations
|
||||
if (!arguments.empty()) {
|
||||
// get raw/pretty
|
||||
if (arguments[0] == (F_(raw))) {
|
||||
EMSESP::watch(EMSESP::WATCH_RAW); // raw
|
||||
} else if (arguments[0] == Helpers::translated_word(FL_(on), true) || arguments[0] == (FL_(on)[0])) {
|
||||
} else if (arguments[0] == (FL_(on)[0])) {
|
||||
EMSESP::watch(EMSESP::WATCH_ON); // on
|
||||
} else if (arguments[0] == Helpers::translated_word(FL_(off), true) || arguments[0] == (FL_(off)[0])) {
|
||||
} else if (arguments[0] == (FL_(off)[0])) {
|
||||
EMSESP::watch(EMSESP::WATCH_OFF); // off
|
||||
} else if (arguments[0] == Helpers::translated_word(FL_(unknown), true) || arguments[0] == (FL_(unknown)[0])) {
|
||||
} else if (arguments[0] == (FL_(unknown)[0])) {
|
||||
EMSESP::watch(EMSESP::WATCH_UNKNOWN); // unknown
|
||||
watch_id = WATCH_ID_NONE;
|
||||
} else {
|
||||
|
||||
@@ -50,12 +50,12 @@ void DallasSensor::start() {
|
||||
EMSdevice::DeviceType::DALLASSENSOR,
|
||||
F_(info),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_info(value, id, output); },
|
||||
F_(info_cmd));
|
||||
FL_(info_cmd));
|
||||
Command::add(
|
||||
EMSdevice::DeviceType::DALLASSENSOR,
|
||||
F_(commands),
|
||||
[&](const char * value, const int8_t id, JsonObject & output) { return command_commands(value, id, output); },
|
||||
F_(commands_cmd));
|
||||
FL_(commands_cmd));
|
||||
|
||||
Mqtt::subscribe(EMSdevice::DeviceType::DALLASSENSOR, "dallasssensor/#", nullptr); // use empty function callback
|
||||
}
|
||||
|
||||
@@ -2227,7 +2227,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) {
|
||||
|
||||
std::string s;
|
||||
if (Helpers::value2string(value, s)) {
|
||||
if (s == Helpers::translated_word(FL_(reset))) {
|
||||
if (s == std::string(Helpers::translated_word(FL_(reset)))) {
|
||||
// LOG_INFO("Reset boiler maintenance message");
|
||||
write_command(0x05, 0x08, 0xFF, 0x1C);
|
||||
return true;
|
||||
|
||||
@@ -594,7 +594,6 @@ void Thermostat::process_RC20Timer(std::shared_ptr<const Telegram> telegram) {
|
||||
|
||||
// we use EN settings for the day abbreviation
|
||||
std::string sday = (FL_(enum_dayOfWeek)[day][0]);
|
||||
// std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]);
|
||||
|
||||
if (day == 7) {
|
||||
snprintf(data, sizeof(data), "%02d not_set", no);
|
||||
@@ -802,19 +801,10 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr<const Telegram> telegram) {
|
||||
char data[sizeof(wwSwitchTime_)];
|
||||
// we use EN settings for the day abbreviation
|
||||
std::string sday = (FL_(enum_dayOfWeek)[day][0]);
|
||||
// std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]);
|
||||
if (day == 7) {
|
||||
snprintf(data, sizeof(data), "%02d not_set", no);
|
||||
} else {
|
||||
snprintf(data,
|
||||
sizeof(data),
|
||||
"%02d %s %02d:%02d %s",
|
||||
no,
|
||||
sday.c_str(),
|
||||
time / 6,
|
||||
10 * (time % 6),
|
||||
// on ? (Helpers::translated_word(FL_(on))).c_str() : (Helpers::translated_word(FL_(off))).c_str());
|
||||
on ? "on" : "off");
|
||||
snprintf(data, sizeof(data), "%02d %s %02d:%02d %s", no, sday.c_str(), time / 6, 10 * (time % 6), on ? "on" : "off");
|
||||
}
|
||||
if (telegram->type_id == 0x38) {
|
||||
has_update(wwSwitchTime_, data, sizeof(wwSwitchTime_));
|
||||
@@ -1281,7 +1271,6 @@ void Thermostat::process_RC35Timer(std::shared_ptr<const Telegram> telegram) {
|
||||
|
||||
// we use EN settings for the day abbreviation
|
||||
std::string sday = (FL_(enum_dayOfWeek)[day][0]);
|
||||
// std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]);
|
||||
if (day == 7) {
|
||||
snprintf(data, sizeof(data), "%02d not_set", no);
|
||||
} else if (model() == EMS_DEVICE_FLAG_RC30) {
|
||||
@@ -2220,82 +2209,93 @@ bool Thermostat::set_roominfl_factor(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// sets the thermostat working mode, where mode is a string
|
||||
// converts string mode to HeatingCircuit::Mode
|
||||
// sets the thermostat working mode
|
||||
bool Thermostat::set_mode(const char * value, const int8_t id) {
|
||||
if ((value == nullptr) || (strlen(value) >= 20)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string mode;
|
||||
|
||||
if (value[0] >= '0' && value[0] <= '9') {
|
||||
uint8_t num = value[0] - '0';
|
||||
switch (model()) {
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC10:
|
||||
mode = Helpers::translated_word(FL_(enum_mode6)[num], true);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC20_N:
|
||||
mode = Helpers::translated_word(FL_(enum_mode2)[num], true);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC25:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC30:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC35:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC30_N:
|
||||
mode = Helpers::translated_word(FL_(enum_mode3)[num], true);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC300:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC100:
|
||||
mode = Helpers::translated_word(FL_(enum_mode)[num], true);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_JUNKERS:
|
||||
mode = Helpers::translated_word(FL_(enum_mode4)[num], true);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_CRF:
|
||||
mode = Helpers::translated_word(FL_(enum_mode5)[num], true);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else if (!Helpers::value2string(value, mode)) {
|
||||
// first determine which enum we are using
|
||||
const char * const ** mode_list = nullptr; // points to a translated list of modes
|
||||
switch (model()) {
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC10:
|
||||
mode_list = FL_(enum_mode6);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC20:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC20_N:
|
||||
mode_list = FL_(enum_mode2);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC25:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC30:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC35:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC30_N:
|
||||
mode_list = FL_(enum_mode3);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC300:
|
||||
case EMSdevice::EMS_DEVICE_FLAG_RC100:
|
||||
mode_list = FL_(enum_mode);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_JUNKERS:
|
||||
mode_list = FL_(enum_mode4);
|
||||
break;
|
||||
case EMSdevice::EMS_DEVICE_FLAG_CRF:
|
||||
mode_list = FL_(enum_mode5);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id;
|
||||
uint8_t enum_index = 0;
|
||||
|
||||
if (Helpers::translated_word(FL_(off), true) == mode) {
|
||||
return set_mode_n(HeatingCircuit::Mode::OFF, hc_num);
|
||||
// check for a mode number as a string with a single digit (0..9)
|
||||
if (value[0] >= '0' && value[0] <= '9') {
|
||||
enum_index = value[0] - '0';
|
||||
if (enum_index >= Helpers::count_items(mode_list)) {
|
||||
return false; // invalid number, not in enum
|
||||
}
|
||||
} else {
|
||||
// check for the mode being a full string name
|
||||
if (!Helpers::value2enum(value, enum_index, mode_list)) {
|
||||
return false; // not found
|
||||
}
|
||||
}
|
||||
if (Helpers::translated_word(FL_(manual), true) == mode) {
|
||||
return set_mode_n(HeatingCircuit::Mode::MANUAL, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(auto), true) == mode) {
|
||||
|
||||
uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; // heating circuit
|
||||
|
||||
// compare the english string
|
||||
auto mode = mode_list[enum_index][0];
|
||||
if (!strcmp(mode, FL_(auto)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::AUTO, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(day), true) == mode) {
|
||||
if (!strcmp(mode, FL_(off)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::OFF, hc_num);
|
||||
}
|
||||
if (!strcmp(mode, FL_(manual)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::MANUAL, hc_num);
|
||||
}
|
||||
if (!strcmp(mode, FL_(day)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::DAY, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(night), true) == mode) {
|
||||
if (!strcmp(mode, FL_(night)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::NIGHT, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(heat), true) == mode) {
|
||||
if (!strcmp(mode, FL_(heat)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::HEAT, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(nofrost), true) == mode) {
|
||||
if (!strcmp(mode, FL_(nofrost)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::NOFROST, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(eco), true) == mode) {
|
||||
if (!strcmp(mode, FL_(eco)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::ECO, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(holiday), true) == mode) {
|
||||
if (!strcmp(mode, FL_(holiday)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::HOLIDAY, hc_num);
|
||||
}
|
||||
if (Helpers::translated_word(FL_(comfort), true) == mode) {
|
||||
if (!strcmp(mode, FL_(comfort)[0])) {
|
||||
return set_mode_n(HeatingCircuit::Mode::COMFORT, hc_num);
|
||||
}
|
||||
|
||||
return false;
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
// Set the thermostat working mode
|
||||
@@ -2318,14 +2318,12 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
|
||||
case HeatingCircuit::Mode::OFF:
|
||||
set_mode_value = 0;
|
||||
break;
|
||||
|
||||
case HeatingCircuit::Mode::DAY:
|
||||
case HeatingCircuit::Mode::HEAT:
|
||||
case HeatingCircuit::Mode::MANUAL:
|
||||
case HeatingCircuit::Mode::NOFROST:
|
||||
set_mode_value = 1;
|
||||
break;
|
||||
|
||||
default: // AUTO & ECO
|
||||
set_mode_value = 2;
|
||||
break;
|
||||
@@ -2690,11 +2688,6 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char
|
||||
if (!strncmp(&value[3], (FL_(enum_dayOfWeek)[i][0]), 2)) {
|
||||
day = i;
|
||||
}
|
||||
|
||||
// auto translated_dow = Helpers::translated_word(FL_(enum_dayOfWeek)[i]);
|
||||
// if (!strncmp(&value[3], translated_dow.c_str(), translated_dow.length())) {
|
||||
// day = i;
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (strlen(value) > 10) {
|
||||
@@ -2734,14 +2727,12 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char
|
||||
if (data[0] != 0xE7) {
|
||||
// we use EN settings for the day abbreviation
|
||||
std::string sday = (FL_(enum_dayOfWeek)[day][0]);
|
||||
// std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]);
|
||||
if (model() == EMS_DEVICE_FLAG_RC35 || model() == EMS_DEVICE_FLAG_RC30_N) {
|
||||
snprintf(out, len, "%02d %s %02d:%02d %s", no, sday.c_str(), time / 6, 10 * (time % 6), on ? "on" : "off");
|
||||
} else if ((model() == EMS_DEVICE_FLAG_RC20) || (model() == EMS_DEVICE_FLAG_RC30)) {
|
||||
snprintf(out, len, "%02d %s %02d:%02d T%d", no, sday.c_str(), time / 6, 10 * (time % 6), on);
|
||||
} else {
|
||||
std::string son = (FL_(enum_switchmode)[on][0]);
|
||||
// std::string son = Helpers::translated_word(FL_(enum_switchmode)[on]);
|
||||
snprintf(out, len, "%02d %s %02d:%02d %s", no, sday.c_str(), time / 6, 10 * (time % 6), son.c_str());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -81,7 +81,7 @@ std::string EMSdevice::brand_to_string() const {
|
||||
}
|
||||
|
||||
// returns the name of the MQTT topic to use for a specific device, without the base
|
||||
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||
const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||
switch (device_type) {
|
||||
case DeviceType::SYSTEM:
|
||||
return (F_(system));
|
||||
@@ -259,7 +259,7 @@ bool EMSdevice::has_tag(const uint8_t tag) const {
|
||||
// called from the command 'entities'
|
||||
void EMSdevice::list_device_entries(JsonObject & output) const {
|
||||
for (const auto & dv : devicevalues_) {
|
||||
std::string fullname = dv.get_fullname();
|
||||
auto fullname = dv.get_fullname();
|
||||
if (!dv.has_state(DeviceValueState::DV_WEB_EXCLUDE) && dv.type != DeviceValueType::CMD && !fullname.empty()) {
|
||||
// if we have a tag prefix it
|
||||
char key[50];
|
||||
@@ -495,8 +495,7 @@ void EMSdevice::add_device_value(uint8_t tag,
|
||||
}
|
||||
|
||||
// add the command to our library
|
||||
// cmd is the short_name and the description is the fullname (not the custom fullname)
|
||||
Command::add(device_type_, short_name, f, Helpers::translated_fullname(fullname), flags);
|
||||
Command::add(device_type_, short_name, f, fullname, flags);
|
||||
}
|
||||
|
||||
// single list of options
|
||||
@@ -638,9 +637,9 @@ void EMSdevice::publish_value(void * value_p) const {
|
||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||
if (Mqtt::publish_single2cmd()) {
|
||||
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", device_type_2_device_name(device_type_).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", device_type_2_device_name(device_type_), tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
} else {
|
||||
snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_), (dv.short_name));
|
||||
}
|
||||
} else if (Mqtt::is_nested() && dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
@@ -663,7 +662,7 @@ void EMSdevice::publish_value(void * value_p) const {
|
||||
Helpers::render_value(payload, *(uint8_t *)(value_p), 0);
|
||||
} else {
|
||||
auto enum_str = Helpers::translated_word(dv.options[*(uint8_t *)(value_p)]);
|
||||
strlcpy(payload, enum_str.c_str(), sizeof(payload));
|
||||
strlcpy(payload, enum_str, sizeof(payload));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -824,7 +823,7 @@ void EMSdevice::generate_values_web(JsonObject & output) {
|
||||
JsonArray l = obj.createNestedArray("l");
|
||||
for (uint8_t i = 0; i < dv.options_size; i++) {
|
||||
auto enum_str = Helpers::translated_word(dv.options[i]);
|
||||
if (!enum_str.empty()) {
|
||||
if (enum_str) {
|
||||
l.add(enum_str);
|
||||
}
|
||||
}
|
||||
@@ -918,12 +917,12 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
||||
// don't add the fullname if its a command
|
||||
auto fullname = Helpers::translated_word(dv.fullname);
|
||||
if (dv.type != DeviceValueType::CMD) {
|
||||
if (!fullname.empty()) {
|
||||
if (fullname) {
|
||||
if ((dv.tag == DeviceValueTAG::TAG_NONE) || tag_to_string(dv.tag).empty()) {
|
||||
obj["n"] = fullname;
|
||||
} else {
|
||||
char name[50];
|
||||
snprintf(name, sizeof(name), "%s %s", tag_to_string(dv.tag).c_str(), fullname.c_str());
|
||||
snprintf(name, sizeof(name), "%s %s", tag_to_string(dv.tag).c_str(), fullname);
|
||||
obj["n"] = name;
|
||||
}
|
||||
}
|
||||
@@ -934,7 +933,7 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
||||
obj["cn"] = custom_fullname;
|
||||
}
|
||||
} else {
|
||||
obj["n"] = "!" + fullname; // prefix commands with a !
|
||||
obj["n"] = "!" + std::string(fullname); // prefix commands with a !
|
||||
}
|
||||
|
||||
// add the custom name, is optional
|
||||
@@ -1363,11 +1362,11 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
|
||||
sizeof(time_s),
|
||||
"%d %s %d %s %d %s",
|
||||
(time_value / 1440),
|
||||
Helpers::translated_word(FL_(days)).c_str(),
|
||||
Helpers::translated_word(FL_(days)),
|
||||
((time_value % 1440) / 60),
|
||||
Helpers::translated_word(FL_(hours)).c_str(),
|
||||
Helpers::translated_word(FL_(hours)),
|
||||
(time_value % 60),
|
||||
Helpers::translated_word(FL_(minutes)).c_str());
|
||||
Helpers::translated_word(FL_(minutes)));
|
||||
json[name] = time_s;
|
||||
} else {
|
||||
json[name] = time_value;
|
||||
|
||||
@@ -46,11 +46,11 @@ class EMSdevice {
|
||||
|
||||
std::string device_type_name() const;
|
||||
|
||||
static std::string device_type_2_device_name(const uint8_t device_type);
|
||||
static uint8_t device_name_2_device_type(const char * topic);
|
||||
static std::string uom_to_string(uint8_t uom);
|
||||
static std::string tag_to_string(uint8_t tag);
|
||||
static std::string tag_to_mqtt(uint8_t tag);
|
||||
static const char * device_type_2_device_name(const uint8_t device_type);
|
||||
static uint8_t device_name_2_device_type(const char * topic);
|
||||
static std::string uom_to_string(uint8_t uom);
|
||||
static std::string tag_to_string(uint8_t tag);
|
||||
static std::string tag_to_mqtt(uint8_t tag);
|
||||
|
||||
bool has_tag(const uint8_t tag) const;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ DeviceValue::DeviceValue(uint8_t device_type,
|
||||
Serial.print(custom_fullname.c_str());
|
||||
Serial.print(COLOR_RESET);
|
||||
} else {
|
||||
Serial.print(Helpers::translated_word(fullname).c_str());
|
||||
Serial.print(Helpers::translated_word(fullname));
|
||||
}
|
||||
Serial.print(" (#options=");
|
||||
Serial.print(options_size);
|
||||
@@ -88,7 +88,7 @@ DeviceValue::DeviceValue(uint8_t device_type,
|
||||
Serial.print(i + 1);
|
||||
Serial.print(":");
|
||||
auto str = Helpers::translated_word(options[i]);
|
||||
Serial.print((str.c_str()));
|
||||
Serial.print(str);
|
||||
i++;
|
||||
}
|
||||
} else if (options_single != nullptr) {
|
||||
|
||||
@@ -1039,7 +1039,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
fetch_device_values(device_id); // go and fetch its data
|
||||
|
||||
// Print to LOG showing we've added a new device
|
||||
LOG_INFO("Recognized new %s with deviceID 0x%02X", EMSdevice::device_type_2_device_name(device_type).c_str(), device_id);
|
||||
LOG_INFO("Recognized new %s with deviceID 0x%02X", EMSdevice::device_type_2_device_name(device_type), device_id);
|
||||
|
||||
// add command commands for all devices, except for connect, controller and gateway
|
||||
if ((device_type == DeviceType::CONNECT) || (device_type == DeviceType::CONTROLLER) || (device_type == DeviceType::GATEWAY)) {
|
||||
@@ -1052,7 +1052,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
||||
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_VERBOSE);
|
||||
},
|
||||
F_(info_cmd));
|
||||
FL_(info_cmd));
|
||||
Command::add(
|
||||
device_type,
|
||||
("values"),
|
||||
@@ -1065,15 +1065,16 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
device_type,
|
||||
F_(commands),
|
||||
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_commands(device_type, output, id); },
|
||||
F_(commands_cmd));
|
||||
FL_(commands_cmd));
|
||||
Command::add(
|
||||
device_type,
|
||||
F_(entities),
|
||||
[device_type](const char * value, const int8_t id, JsonObject & output) { return command_entities(device_type, output, id); },
|
||||
F_(entities_cmd));
|
||||
FL_(entities_cmd));
|
||||
|
||||
// MQTT subscribe to the device e.g. "ems-esp/boiler/#"
|
||||
Mqtt::subscribe(device_type, EMSdevice::device_type_2_device_name(device_type) + "/#", nullptr);
|
||||
auto topic = std::string(EMSdevice::device_type_2_device_name(device_type)) + "/#";
|
||||
Mqtt::subscribe(device_type, topic, nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -179,9 +179,9 @@ char * Helpers::render_boolean(char * result, const bool value, const bool dashb
|
||||
uint8_t bool_format_ = dashboard ? EMSESP::system_.bool_dashboard() : EMSESP::system_.bool_format();
|
||||
|
||||
if (bool_format_ == BOOL_FORMAT_ONOFF_STR) {
|
||||
strlcpy(result, value ? translated_word(FL_(on)).c_str() : translated_word(FL_(off)).c_str(), 5);
|
||||
strlcpy(result, value ? translated_word(FL_(on)) : translated_word(FL_(off)), 5);
|
||||
} else if (bool_format_ == BOOL_FORMAT_ONOFF_STR_CAP) {
|
||||
strlcpy(result, value ? translated_word(FL_(ON)).c_str() : translated_word(FL_(OFF)).c_str(), 5);
|
||||
strlcpy(result, value ? translated_word(FL_(ON)) : translated_word(FL_(OFF)), 5);
|
||||
} else if ((bool_format_ == BOOL_FORMAT_10) || (bool_format_ == BOOL_FORMAT_10_STR)) {
|
||||
strlcpy(result, value ? "1" : "0", 2);
|
||||
} else {
|
||||
@@ -593,12 +593,12 @@ bool Helpers::value2bool(const char * value, bool & value_b) {
|
||||
|
||||
std::string bool_str = toLower(value); // convert to lower case
|
||||
|
||||
if ((bool_str == Helpers::translated_word(FL_(on))) || (bool_str == "on") || (bool_str == "1") || (bool_str == "true")) {
|
||||
if ((bool_str == std::string(Helpers::translated_word(FL_(on)))) || (bool_str == "on") || (bool_str == "1") || (bool_str == "true")) {
|
||||
value_b = true;
|
||||
return true; // is a bool
|
||||
}
|
||||
|
||||
if ((bool_str == Helpers::translated_word(FL_(off))) || (bool_str == "off") || (bool_str == "0") || (bool_str == "false")) {
|
||||
if ((bool_str == std::string(Helpers::translated_word(FL_(off)))) || (bool_str == "off") || (bool_str == "0") || (bool_str == "false")) {
|
||||
value_b = false;
|
||||
return true; // is a bool
|
||||
}
|
||||
@@ -615,7 +615,7 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * co
|
||||
std::string str = toLower(value);
|
||||
|
||||
for (value_ui = 0; strs[value_ui]; value_ui++) {
|
||||
std::string str1 = toLower(Helpers::translated_word(strs[value_ui]));
|
||||
std::string str1 = toLower(std::string(Helpers::translated_word(strs[value_ui])));
|
||||
std::string str2 = toLower((strs[value_ui][0])); // also check for default language
|
||||
if ((str1 != "")
|
||||
&& ((str2 == "off" && str == "false") || (str2 == "on" && str == "true") || (str == str1) || (str == str2)
|
||||
@@ -627,19 +627,25 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * co
|
||||
return false;
|
||||
}
|
||||
|
||||
// checks to see if a string is member of a vector and return the index, also allow true/false for on/off
|
||||
// finds the string (value) of a list vector (strs)
|
||||
// returns true if found, and sets the value_ui to the index, else false
|
||||
// also allow true/false for on/off
|
||||
bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * const * strs) {
|
||||
if ((value == nullptr) || (strlen(value) == 0)) {
|
||||
return false;
|
||||
}
|
||||
std::string str = toLower(value);
|
||||
|
||||
std::string s_on = Helpers::translated_word(FL_(on));
|
||||
std::string s_off = Helpers::translated_word(FL_(off));
|
||||
|
||||
// stops when a nullptr is found, which is the end delimeter of a MAKE_PSTR_LIST()
|
||||
// could use count_items() to avoid buffer over-run but this works
|
||||
for (value_ui = 0; strs[value_ui]; value_ui++) {
|
||||
std::string enum_str = toLower((strs[value_ui]));
|
||||
|
||||
if ((enum_str != "")
|
||||
&& ((enum_str == "off" && (str == Helpers::translated_word(FL_(off)) || str == "false"))
|
||||
|| (enum_str == "on" && (str == Helpers::translated_word(FL_(on)) || str == "true")) || (str == enum_str)
|
||||
&& ((enum_str == "off" && (str == s_off || str == "false")) || (enum_str == "on" && (str == s_on || str == "true")) || (str == enum_str)
|
||||
|| (value[0] == ('0' + value_ui) && value[1] == '\0'))) {
|
||||
return true;
|
||||
}
|
||||
@@ -702,31 +708,13 @@ uint8_t Helpers::count_items(const char * const ** list) {
|
||||
return list_size;
|
||||
}
|
||||
|
||||
// return translated string as a std::string, optionally converting to lowercase (for console commands)
|
||||
std::string Helpers::translated_word(const char * const * strings, bool to_lower) {
|
||||
uint8_t language_index = EMSESP::system_.language_index();
|
||||
uint8_t index = 0;
|
||||
|
||||
// check for empty
|
||||
if (!strings) {
|
||||
return ""; // it's a nullptr with no translations, return empty to prevent unwanted crash
|
||||
}
|
||||
|
||||
// see how many translations we have for this entity. if there is no translation for this, revert to EN
|
||||
if (Helpers::count_items(strings) >= language_index + 1 && strlen(strings[language_index])) {
|
||||
index = language_index;
|
||||
}
|
||||
return to_lower ? toLower((strings[index])) : (strings[index]);
|
||||
}
|
||||
|
||||
// returns char pointer to translated description or fullname
|
||||
const char * Helpers::translated_fullname(const char * const * strings) {
|
||||
const char * Helpers::translated_word(const char * const * strings) {
|
||||
uint8_t language_index = EMSESP::system_.language_index();
|
||||
uint8_t index = 0;
|
||||
|
||||
// check for empty
|
||||
if (!strings) {
|
||||
return nullptr; // it's a nullptr with no translations, return empty to prevent unwanted crash
|
||||
return ""; // no translations
|
||||
}
|
||||
|
||||
// see how many translations we have for this entity. if there is no translation for this, revert to EN
|
||||
|
||||
@@ -77,9 +77,7 @@ class Helpers {
|
||||
static uint8_t count_items(const char * const ** list);
|
||||
static uint8_t count_items(const char * const * list);
|
||||
|
||||
static std::string translated_word(const char * const * strings, bool to_lower = false);
|
||||
static const char * translated_fullname(const char * const * strings);
|
||||
|
||||
static const char * translated_word(const char * const * strings);
|
||||
|
||||
#ifdef EMSESP_STANDALONE
|
||||
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
||||
|
||||
@@ -219,11 +219,6 @@ MAKE_PSTR(uom_sqm, "sqm")
|
||||
MAKE_PSTR(uom_m3, "m3")
|
||||
MAKE_PSTR(uom_l, "l")
|
||||
|
||||
// commands
|
||||
MAKE_PSTR(info_cmd, "lists all values")
|
||||
MAKE_PSTR(commands_cmd, "lists all commands")
|
||||
MAKE_PSTR(entities_cmd, "lists all entities")
|
||||
|
||||
// TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp
|
||||
// use empty string if want to suppress showing tags
|
||||
// mqtt tags must not have spaces
|
||||
|
||||
@@ -28,9 +28,26 @@
|
||||
#define EMSESP_LOCALE_PL "pl"
|
||||
#define EMSESP_LOCALE_NO "no"
|
||||
|
||||
// translations are in order en, de,nl, se....
|
||||
// translations are in order en, de, nl, se, pl, no, ....
|
||||
// if there is no translation, it will default to en
|
||||
|
||||
// commands
|
||||
MAKE_PSTR_LIST(info_cmd, "lists all values")
|
||||
MAKE_PSTR_LIST(commands_cmd, "lists all commands")
|
||||
MAKE_PSTR_LIST(entities_cmd, "lists all entities")
|
||||
MAKE_PSTR_LIST(send_cmd, "send a telegram")
|
||||
MAKE_PSTR_LIST(setiovalue_cmd, "set io value")
|
||||
MAKE_PSTR_LIST(changeloglevel_cmd, "change log level")
|
||||
MAKE_PSTR_LIST(fetch_cmd, "refresh all EMS values")
|
||||
MAKE_PSTR_LIST(restart_cmd, "restart EMS-ESP")
|
||||
MAKE_PSTR_LIST(watch_cmd, "watch incoming telegrams")
|
||||
MAKE_PSTR_LIST(publish_cmd, "publish all to MQTT")
|
||||
MAKE_PSTR_LIST(system_info_cmd, "show system status")
|
||||
|
||||
#if defined(EMSESP_DEBUG)
|
||||
MAKE_PSTR_LIST(test_cmd, "run a test")
|
||||
#endif
|
||||
|
||||
// General
|
||||
MAKE_PSTR_LIST(on, "on", "an", "aan", "på")
|
||||
MAKE_PSTR_LIST(off, "off", "aus", "uit", "av")
|
||||
|
||||
22
src/mqtt.cpp
22
src/mqtt.cpp
@@ -899,15 +899,16 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model,
|
||||
StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> dev_json;
|
||||
|
||||
// always create the ids
|
||||
JsonArray ids = dev_json.createNestedArray("ids");
|
||||
char ha_device[40];
|
||||
std::string device_type_name = EMSdevice::device_type_2_device_name(dv.device_type);
|
||||
snprintf(ha_device, sizeof(ha_device), "ems-esp-%s", device_type_name.c_str());
|
||||
JsonArray ids = dev_json.createNestedArray("ids");
|
||||
char ha_device[40];
|
||||
auto device_type_name = EMSdevice::device_type_2_device_name(dv.device_type);
|
||||
snprintf(ha_device, sizeof(ha_device), "ems-esp-%s", device_type_name);
|
||||
ids.add(ha_device);
|
||||
|
||||
if (create_device_config) {
|
||||
device_type_name[0] = toupper(device_type_name[0]); // capitalize
|
||||
dev_json["name"] = "EMS-ESP " + device_type_name;
|
||||
auto cap_name = strdup(device_type_name);
|
||||
cap_name[0] = toupper(cap_name[0]); // capitalize
|
||||
dev_json["name"] = std::string("EMS-ESP ") + cap_name;
|
||||
dev_json["mf"] = brand;
|
||||
dev_json["mdl"] = model;
|
||||
dev_json["via_device"] = "ems-esp";
|
||||
@@ -972,8 +973,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice
|
||||
}
|
||||
|
||||
// create the device name
|
||||
char device_name[50];
|
||||
strlcpy(device_name, EMSdevice::device_type_2_device_name(device_type).c_str(), sizeof(device_name));
|
||||
auto device_name = EMSdevice::device_type_2_device_name(device_type);
|
||||
|
||||
// create entity by add the hc/wwc tag if present, separating with a .
|
||||
char new_entity[50];
|
||||
@@ -1341,11 +1341,13 @@ std::string Mqtt::tag_to_topic(uint8_t device_type, uint8_t tag) {
|
||||
return EMSdevice::tag_to_mqtt(tag);
|
||||
}
|
||||
|
||||
std::string topic = EMSdevice::device_type_2_device_name(device_type);
|
||||
|
||||
// if there is a tag add it
|
||||
if (!EMSdevice::tag_to_mqtt(tag).empty() && ((tag == DeviceValueTAG::TAG_BOILER_DATA_WW) || (!is_nested() && tag >= DeviceValueTAG::TAG_HC1))) {
|
||||
return EMSdevice::device_type_2_device_name(device_type) + "_data_" + EMSdevice::tag_to_mqtt(tag);
|
||||
return topic + "_data_" + EMSdevice::tag_to_mqtt(tag);
|
||||
} else {
|
||||
return EMSdevice::device_type_2_device_name(device_type) + "_data";
|
||||
return topic + "_data";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -249,8 +249,7 @@ void System::syslog_init() {
|
||||
syslog_.hostname(hostname().c_str());
|
||||
|
||||
// register the command
|
||||
// TODO translate this
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, ("change the syslog level"), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, FL_(changeloglevel_cmd), CommandFlag::ADMIN_ONLY);
|
||||
|
||||
} else if (was_enabled) {
|
||||
// in case service is still running, this flushes the queue
|
||||
@@ -664,25 +663,21 @@ void System::system_check() {
|
||||
|
||||
// commands - takes static function pointers
|
||||
void System::commands_init() {
|
||||
// TODO translate this
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, ("send a telegram"), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, ("refresh all EMS values"), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, ("restart EMS-ESP"), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, ("watch incoming telegrams"));
|
||||
|
||||
// register syslog command in syslog init
|
||||
// Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, ("set syslog level"), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, FL_(send_cmd), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, FL_(fetch_cmd), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, FL_(restart_cmd), CommandFlag::ADMIN_ONLY);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, FL_(watch_cmd));
|
||||
|
||||
if (Mqtt::enabled()) {
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, ("force a MQTT publish"));
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, FL_(publish_cmd));
|
||||
}
|
||||
|
||||
// these commands will return data in JSON format
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, ("show system status"));
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, ("fetch system commands"));
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, FL_(system_info_cmd));
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, FL_(commands_cmd));
|
||||
|
||||
#if defined(EMSESP_DEBUG)
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, ("run a specific test"));
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, FL_(test_cmd));
|
||||
#endif
|
||||
|
||||
// MQTT subscribe "ems-esp/system/#"
|
||||
|
||||
@@ -246,6 +246,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
shell.invoke_command("show mqtt");
|
||||
}
|
||||
|
||||
if (command == "modes") {
|
||||
shell.printfln("Testing thermostat modes...");
|
||||
run_test("general");
|
||||
shell.invoke_command("call thermostat mode auto");
|
||||
shell.invoke_command("call thermostat mode Manuell"); // DE
|
||||
shell.invoke_command("call thermostat mode 1");
|
||||
}
|
||||
|
||||
if (command == "render") {
|
||||
shell.printfln("Testing render...");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user