Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add change global hum and temp with command #8152

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tasmota/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@
#define D_JSON_BASE "BASE"
#define D_CMND_TEMPOFFSET "TempOffset"
#define D_CMND_HUMOFFSET "HumOffset"
#define D_CMND_GLOBAL_TEMP "GlobalTemp"
#define D_CMND_GLOBAL_HUM "GlobalHum"

// Commands xdrv_01_mqtt.ino
#define D_CMND_MQTTLOG "MqttLog"
Expand Down
26 changes: 24 additions & 2 deletions tasmota/support_command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix
D_CMND_SERIALDELIMITER "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|" D_CMND_WIFICONFIG "|"
D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|" D_CMND_INTERLOCK "|" D_CMND_TELEPERIOD "|" D_CMND_RESET "|" D_CMND_TIME "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|"
D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|" D_CMND_LEDMASK "|" D_CMND_WIFIPOWER "|" D_CMND_TEMPOFFSET "|" D_CMND_HUMOFFSET "|"
D_CMND_SPEEDUNIT "|"
D_CMND_SPEEDUNIT "|" D_CMND_GLOBAL_TEMP "|" D_CMND_GLOBAL_HUM "|"
#ifdef USE_I2C
D_CMND_I2CSCAN "|" D_CMND_I2CDRIVER "|"
#endif
Expand All @@ -50,7 +50,7 @@ void (* const TasmotaCommand[])(void) PROGMEM = {
&CmndSerialDelimiter, &CmndIpAddress, &CmndNtpServer, &CmndAp, &CmndSsid, &CmndPassword, &CmndHostname, &CmndWifiConfig,
&CmndFriendlyname, &CmndSwitchMode, &CmndInterlock, &CmndTeleperiod, &CmndReset, &CmndTime, &CmndTimezone, &CmndTimeStd,
&CmndTimeDst, &CmndAltitude, &CmndLedPower, &CmndLedState, &CmndLedMask, &CmndWifiPower, &CmndTempOffset, &CmndHumOffset,
&CmndSpeedUnit,
&CmndSpeedUnit, &CmndGlobalTemp, &CmndGlobalHum,
#ifdef USE_I2C
&CmndI2cScan, CmndI2cDriver,
#endif
Expand Down Expand Up @@ -576,6 +576,28 @@ void CmndHumOffset(void)
ResponseCmndFloat((float)(Settings.hum_comp) / 10, 1);
}

void CmndGlobalTemp(void)
{
if (XdrvMailbox.data_len > 0) {
int value = (int)(CharToFloat(XdrvMailbox.data) * 10);
if ((value > -401) && (value < 801)) {
ConvertTemp(value);
}
}
ResponseCmndFloat((float)(global_temperature) / 10, 1);
}

void CmndGlobalHum(void)
{
if (XdrvMailbox.data_len > 0) {
int value = (int)(CharToFloat(XdrvMailbox.data) * 10);
if ((value > -10) && (value < 999)) {
ConvertHumidity(value);
}
}
ResponseCmndFloat((float)(global_humidity) / 10, 1);
}

void CmndSleep(void)
{
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 251)) {
Expand Down