Merge pull request #778 from MichaelDvP/dev

Basetranslation, HA-mode fix, analog inputs, etc.
This commit is contained in:
Proddy
2022-11-28 09:56:34 +01:00
committed by GitHub
11 changed files with 75 additions and 62 deletions

View File

@@ -36,6 +36,7 @@ jobs:
cd interface
npm ci
npx typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
npm run build
- name: Build firmware

View File

@@ -1,5 +1,5 @@
{
"adapter": "react",
"baseLocale": "pl",
"$schema": "https://unpkg.com/typesafe-i18n@5.16.3/schema/typesafe-i18n.json"
"$schema": "https://unpkg.com/typesafe-i18n@5.17.0/schema/typesafe-i18n.json"
}

View File

@@ -1,8 +1,8 @@
import type { BaseTranslation } from '../i18n-types';
import type { Translation } from '../i18n-types';
/* prettier-ignore */
/* eslint-disable */
const en: BaseTranslation = {
const en: Translation = {
LANGUAGE: 'Language',
RETRY: 'Retry',
LOADING: 'Loading',

View File

@@ -1,8 +1,8 @@
import type { Translation } from '../i18n-types';
import type { BaseTranslation } from '../i18n-types';
/* prettier-ignore */
/* eslint-disable */
const pl: Translation = {
const pl: BaseTranslation = {
LANGUAGE: 'Język',
RETRY: 'Ponów',
LOADING: 'Ładowanie',

View File

@@ -1123,7 +1123,7 @@ const DashboardData: FC = () => {
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
inputProps={{ min: '0', step: '1' }}
inputProps={{ step: '0.001' }}
/>
</Grid>
)}
@@ -1136,7 +1136,7 @@ const DashboardData: FC = () => {
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
inputProps={{ min: '-100', max: '100', step: '0.1' }}
inputProps={{ step: '0.001' }}
/>
</Grid>
</>

View File

@@ -24,8 +24,23 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
root["status"] = (uint8_t)wifi_status;
}
// for Wifi
if (wifi_status == WL_CONNECTED) {
// for both connections show ethernet
if (ethernet_connected) {
// Ethernet
root["local_ip"] = ETH.localIP().toString();
root["local_ipv6"] = ETH.localIPv6().toString();
root["mac_address"] = ETH.macAddress();
root["subnet_mask"] = ETH.subnetMask().toString();
root["gateway_ip"] = ETH.gatewayIP().toString();
IPAddress dnsIP1 = ETH.dnsIP(0);
IPAddress dnsIP2 = ETH.dnsIP(1);
if (IPUtils::isSet(dnsIP1)) {
root["dns_ip_1"] = dnsIP1.toString();
}
if (IPUtils::isSet(dnsIP2)) {
root["dns_ip_2"] = dnsIP2.toString();
}
} else if (wifi_status == WL_CONNECTED) {
root["local_ip"] = WiFi.localIP().toString();
root["local_ipv6"] = WiFi.localIPv6().toString();
root["mac_address"] = WiFi.macAddress();
@@ -47,21 +62,6 @@ void NetworkStatus::networkStatus(AsyncWebServerRequest * request) {
if (dnsIP2 != INADDR_NONE) {
root["dns_ip_2"] = dnsIP2.toString();
}
} else if (ethernet_connected) {
// Ethernet
root["local_ip"] = ETH.localIP().toString();
root["local_ipv6"] = ETH.localIPv6().toString();
root["mac_address"] = ETH.macAddress();
root["subnet_mask"] = ETH.subnetMask().toString();
root["gateway_ip"] = ETH.gatewayIP().toString();
IPAddress dnsIP1 = ETH.dnsIP(0);
IPAddress dnsIP2 = ETH.dnsIP(1);
if (IPUtils::isSet(dnsIP1)) {
root["dns_ip_1"] = dnsIP1.toString();
}
if (IPUtils::isSet(dnsIP2)) {
root["dns_ip_2"] = dnsIP2.toString();
}
}
response->setLength();

View File

@@ -24,6 +24,10 @@ def buildWeb():
try:
env.Execute("npm install")
env.Execute("npx typesafe-i18n --no-watch")
with open("./src/i18n/i18n-util.ts") as r:
text = r.read().replace("Locales = 'pl'", "Locales = 'en'")
with open("./src/i18n/i18n-util.ts", "w") as w:
w.write(text)
env.Execute("npm run build")
buildPath = Path("build")
wwwPath = Path("../data/www")

View File

@@ -39,9 +39,9 @@
{167, DeviceType::BOILER, "Cerapur Aero", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{168, DeviceType::BOILER, "Hybrid Heatpump", DeviceFlags::EMS_DEVICE_FLAG_HYBRID},
{170, DeviceType::BOILER, "Logano GB212", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{172, DeviceType::BOILER, "Enviline/Compress 6000AW/Hybrid 7000iAW/SupraEco/Geo 5xx", DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP},
{172, DeviceType::BOILER, "Enviline/Compress 6000AW/Hybrid 7000iAW/SupraEco/Geo 5xx/WLW196i", DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP},
{173, DeviceType::BOILER, "Geo 5xx", DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP},
{195, DeviceType::BOILER, "Condens 5000i/Greenstar 8000", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{195, DeviceType::BOILER, "Condens 5000i/Greenstar 8000/GC9800IW", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{203, DeviceType::BOILER, "Logamax U122/Cerapur", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{206, DeviceType::BOILER, "Ecomline Excellent", DeviceFlags::EMS_DEVICE_FLAG_NONE},
{208, DeviceType::BOILER, "Logamax Plus/GB192/Condens GC9000/Greenstar ErP", DeviceFlags::EMS_DEVICE_FLAG_NONE},

View File

@@ -2251,9 +2251,13 @@ bool Thermostat::set_mode(const char * value, const int8_t id) {
} else {
// check for the mode being a full string name
if (!Helpers::value2enum(value, enum_index, mode_list)) {
mode_list = FL_(enum_mode_ha);
if (Mqtt::ha_enabled() && !Helpers::value2enum(value, enum_index, mode_list)) {
LOG_WARNING("wrong mode: %s", value);
return false; // not found
}
}
}
uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; // heating circuit

View File

@@ -278,6 +278,7 @@ MAKE_PSTR_ENUM(enum_mode3, FL_(night), FL_(day), FL_(auto)) // RC35
MAKE_PSTR_ENUM(enum_mode4, FL_(nofrost), FL_(eco), FL_(heat), FL_(auto)) // JUNKERS
MAKE_PSTR_ENUM(enum_mode5, FL_(auto), FL_(off)) // CRF
MAKE_PSTR_ENUM(enum_mode6, FL_(nofrost), FL_(night), FL_(day)) // RC10
MAKE_PSTR_ENUM(enum_mode_ha, FL_(off), FL_(heat), FL_(auto)) // HA climate
MAKE_PSTR_ENUM(enum_modetype, FL_(eco), FL_(comfort))
MAKE_PSTR_ENUM(enum_modetype3, FL_(night), FL_(day))

View File

@@ -541,7 +541,17 @@ void System::send_info_mqtt(const char * event_str) {
doc["event"] = event_str;
doc["version"] = EMSESP_APP_VERSION;
#ifndef EMSESP_STANDALONE
if (WiFi.status() == WL_CONNECTED) {
if (EMSESP::system_.ethernet_connected()) {
doc["connection"] = "ethernet";
doc["hostname"] = ETH.getHostname();
doc["MAC"] = ETH.macAddress();
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
} else if (WiFi.status() == WL_CONNECTED) {
doc["connection"] = "wifi";
doc["hostname"] = WiFi.getHostname();
doc["SSID"] = WiFi.SSID();
@@ -554,16 +564,6 @@ void System::send_info_mqtt(const char * event_str) {
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
}
} else if (EMSESP::system_.ethernet_connected()) {
doc["connection"] = "ethernet";
doc["hostname"] = ETH.getHostname();
doc["MAC"] = ETH.macAddress();
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
doc["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
doc["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
doc["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
}
#endif
Mqtt::publish_retain(F_(info), doc.as<JsonObject>(), true); // topic called "info" and it's Retained
@@ -1062,6 +1062,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
// node["uptime (seconds)"] = uuid::get_uptime_sec();
#ifndef EMSESP_STANDALONE
node["freemem"] = ESP.getFreeHeap() / 1024; // kilobytes
node["maxalloc"] = ESP.getMaxAllocHeap() / 1024; // kilobytes
node["free_app"] = EMSESP::system_.appFree(); // kilobytes
#endif
node["reset reason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
@@ -1069,7 +1070,17 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
#ifndef EMSESP_STANDALONE
// Network Status
node = output.createNestedObject("Network Info");
if (WiFi.status() == WL_CONNECTED) {
if (EMSESP::system_.ethernet_connected()) {
node["connection"] = "Ethernet";
node["hostname"] = ETH.getHostname();
node["MAC"] = ETH.macAddress();
node["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
node["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
node["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
node["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
} else if (WiFi.status() == WL_CONNECTED) {
node["connection"] = "WiFi";
node["hostname"] = WiFi.getHostname();
// node["SSID"] = WiFi.SSID();
@@ -1082,22 +1093,6 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
node["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
}
} else if (EMSESP::system_.ethernet_connected()) {
node["connection"] = "Ethernet";
node["hostname"] = ETH.getHostname();
node["MAC"] = ETH.macAddress();
node["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
node["IPv4 gateway"] = uuid::printable_to_string(ETH.gatewayIP());
node["IPv4 nameserver"] = uuid::printable_to_string(ETH.dnsIP());
if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") {
node["IPv6 address"] = uuid::printable_to_string(ETH.localIPv6());
}
EMSESP::webSettingsService.read([&](WebSettings & settings) {
node["phy type"] = settings.phy_type;
node["eth power"] = settings.eth_power;
node["eth phy addr"] = settings.eth_phy_addr;
node["eth clock mode"] = settings.eth_clock_mode;
});
}
#endif
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & settings) {
@@ -1236,11 +1231,19 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
node["shower alert coldshot"] = settings.shower_alert_coldshot; // seconds
node["shower alert trigger"] = settings.shower_alert_trigger; // minutes
}
if (settings.board_profile == "CUSTOM") {
node["phy type"] = settings.phy_type;
if (settings.phy_type != PHY_type::PHY_TYPE_NONE) {
node["eth power"] = settings.eth_power;
node["eth phy_addr"] = settings.eth_phy_addr;
node["eth clock_mode"] = settings.eth_clock_mode;
}
node["rx gpio"] = settings.rx_gpio;
node["tx gpio"] = settings.tx_gpio;
node["dallas gpio"] = settings.dallas_gpio;
node["pbutton gpio"] = settings.pbutton_gpio;
node["led gpio"] = settings.led_gpio;
}
node["hide led"] = settings.hide_led;
node["notoken api"] = settings.notoken_api;
node["readonly mode"] = settings.readonly_mode;