mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-25 14:56:11 +02:00
removed MQTT subscription sync_ntp
, set_time
with a value of 0
does the same #696
simplified MQTT subscription for `limit`. Check User-Manual.md for new syntax #696, #713 repaired inverter wise limit control, #713
This commit is contained in:
parent
0cc6e09383
commit
3e919b4d10
11 changed files with 56 additions and 81 deletions
|
@ -91,9 +91,6 @@ The AhoyDTU will publish on the following topics
|
||||||
|
|
||||||
## Active Power Limit via Serial / Control Page
|
## Active Power Limit via Serial / Control Page
|
||||||
URL: `/serial`
|
URL: `/serial`
|
||||||
If you leave the field "Active Power Limit" empty during the setup and reboot the ahoy-dtu will set a value of 65535 in the setup.
|
|
||||||
That is the value you have to fill in case you want to operate the inverter without a active power limit.
|
|
||||||
If the value is 65535 or -1 after another reboot the value will be set automatically to "100" and in the drop-down menu "relative in percent persistent" will be set. Of course you can do this also by your self.
|
|
||||||
|
|
||||||
You can change the setting in the following manner.
|
You can change the setting in the following manner.
|
||||||
Decide if you want to set
|
Decide if you want to set
|
||||||
|
@ -115,24 +112,17 @@ Also an absolute active power limit below approx. 30 Watt seems to be not meanfu
|
||||||
|
|
||||||
### Generic Information
|
### Generic Information
|
||||||
|
|
||||||
The AhoyDTU subscribes on three topics `<TOPIC>/ctrl/#`, `<TOPIC>/setup` and `<TOPIC>/status`.
|
The AhoyDTU subscribes on following topics:
|
||||||
|
|
||||||
|
- `<TOPIC>/ctrl/limit/<INVERTER_ID>`
|
||||||
|
- `<TOPIC>/ctrl/restart/<INVERTER_ID>`
|
||||||
|
- `<TOPIC>/setup/set_time`
|
||||||
|
|
||||||
👆 `<TOPIC>` can be set on setup page, default is `inverter`.
|
👆 `<TOPIC>` can be set on setup page, default is `inverter`.
|
||||||
|
|
||||||
👆 `<INVERTER_ID>` is the number of the specific inverter in the setup page.
|
👆 `<INVERTER_ID>` is the number of the specific inverter in the setup page.
|
||||||
|
|
||||||
|
|
||||||
### Inverter Power (On / Off)
|
|
||||||
```mqtt
|
|
||||||
<TOPIC>/ctrl/power/<INVERTER_ID>
|
|
||||||
```
|
|
||||||
with payload `1` = `ON` and `0` = `OFF`
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```mqtt
|
|
||||||
inverter/ctrl/power/0 1
|
|
||||||
```
|
|
||||||
|
|
||||||
### Inverter restart
|
### Inverter restart
|
||||||
```mqtt
|
```mqtt
|
||||||
<TOPIC>/ctrl/restart/<INVERTER_ID>
|
<TOPIC>/ctrl/restart/<INVERTER_ID>
|
||||||
|
@ -142,50 +132,35 @@ Example:
|
||||||
inverter/ctrl/restart/0
|
inverter/ctrl/restart/0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Power Limit relative persistent [%]
|
### Power Limit relative (non persistent) [%]
|
||||||
|
|
||||||
```mqtt
|
```mqtt
|
||||||
<TOPIC>/ctrl/limit_persistent_relative/<INVERTER_ID>
|
<TOPIC>/ctrl/limit/<INVERTER_ID>
|
||||||
```
|
```
|
||||||
with a payload `[2 .. 100]`
|
with a payload `[2 .. 100]`
|
||||||
|
|
||||||
|
**NOTE: optional a `%` can be sent as last character**
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```mqtt
|
```mqtt
|
||||||
inverter/ctrl/limit_persistent_relative/0 70
|
inverter/ctrl/limit/0 70
|
||||||
```
|
```
|
||||||
|
|
||||||
### Power Limit absolute persistent [Watts]
|
### Power Limit absolute (non persistent) [Watts]
|
||||||
```mqtt
|
```mqtt
|
||||||
<TOPIC>/ctrl/limit_persistent_absolute/<INVERTER_ID>
|
<TOPIC>/ctrl/limit/<INVERTER_ID>
|
||||||
```
|
```
|
||||||
with a payload `[0 .. 65535]`
|
with a payload `[0 .. 65535]`
|
||||||
|
|
||||||
Example:
|
**NOTE: the unit `W` is necessary to determine an absolute limit**
|
||||||
```mqtt
|
|
||||||
inverter/ctrl/limit_persistent_absolute/0 600
|
|
||||||
```
|
|
||||||
|
|
||||||
### Power Limit relative non persistent [%]
|
|
||||||
```mqtt
|
|
||||||
<TOPIC>/ctrl/limit_nonpersistent_relative/<INVERTER_ID>
|
|
||||||
```
|
|
||||||
with a payload `[2 .. 100]`
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```mqtt
|
```mqtt
|
||||||
inverter/ctrl/limit_nonpersistent_relative/0 70
|
inverter/ctrl/limit_nonpersistent_absolute/0 600W
|
||||||
```
|
```
|
||||||
|
|
||||||
### Power Limit absolute non persistent [Watts]
|
### Power Limit persistent
|
||||||
```mqtt
|
This feature was removed. The persisten limit should not be modified cyclic by a script because of potential wearout of the flash inside the inverter.
|
||||||
<TOPIC>/ctrl/limit_nonpersistent_absolute/<INVERTER_ID>
|
|
||||||
```
|
|
||||||
with a payload `[0 .. 65535]`
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```mqtt
|
|
||||||
inverter/ctrl/limit_nonpersistent_absolute/0 600
|
|
||||||
```
|
|
||||||
|
|
||||||
## Control via REST API
|
## Control via REST API
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
## 0.5.98
|
## 0.5.98
|
||||||
* fix SH1106 rotation and turn off during night #756
|
* fix SH1106 rotation and turn off during night #756
|
||||||
|
* removed MQTT subscription `sync_ntp`, `set_time` with a value of `0` does the same #696
|
||||||
|
* simplified MQTT subscription for `limit`. Check [User-Manual.md](../User-Manual.md) for new syntax #696, #713
|
||||||
|
* repaired inverter wise limit control
|
||||||
|
|
||||||
## 0.5.97
|
## 0.5.97
|
||||||
* Attention: re-ordered display types, check your settings! #746
|
* Attention: re-ordered display types, check your settings! #746
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
License
|
|
||||||
|
|
||||||
CC-CY-NC-SA 3.0
|
|
||||||
|
|
||||||
https://creativecommons.org/licenses/by-nc-sa/3.0/de
|
|
||||||
|
|
||||||
This project is for non-commercial use only!
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2023 Ahoy, https://ahoydtu.de
|
// 2023 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2023 Ahoy, https://ahoydtu.de
|
// 2023 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __APP_H__
|
#ifndef __APP_H__
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2022 Ahoy, https://ahoydtu.de
|
// 2022 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __IAPP_H__
|
#ifndef __IAPP_H__
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2023 Ahoy, https://www.mikrocontroller.net/topic/525778
|
// 2023 Ahoy, https://www.mikrocontroller.net/topic/525778
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __DEFINES_H__
|
#ifndef __DEFINES_H__
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 5
|
||||||
#define VERSION_PATCH 97
|
#define VERSION_PATCH 98
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778
|
// 2023 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "utils/dbg.h"
|
#include "utils/dbg.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2023 Ahoy, https://ahoydtu.de
|
// 2023 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// https://bert.emelis.net/espMqttClient/
|
// https://bert.emelis.net/espMqttClient/
|
||||||
|
@ -312,13 +312,14 @@ class PubMqtt {
|
||||||
tickerMinute();
|
tickerMinute();
|
||||||
publish(mLwtTopic, mqttStr[MQTT_STR_LWT_CONN], true, false);
|
publish(mLwtTopic, mqttStr[MQTT_STR_LWT_CONN], true, false);
|
||||||
|
|
||||||
subscribe(subscr[MQTT_SUBS_LMT_PERI_REL]);
|
char sub[20];
|
||||||
subscribe(subscr[MQTT_SUBS_LMT_PERI_ABS]);
|
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||||
subscribe(subscr[MQTT_SUBS_LMT_NONPERI_REL]);
|
snprintf(sub, 20, "ctrl/limit/%d", i);
|
||||||
subscribe(subscr[MQTT_SUBS_LMT_NONPERI_ABS]);
|
subscribe(sub);
|
||||||
|
snprintf(sub, 20, "ctrl/restart/%d", i);
|
||||||
|
subscribe(sub);
|
||||||
|
}
|
||||||
subscribe(subscr[MQTT_SUBS_SET_TIME]);
|
subscribe(subscr[MQTT_SUBS_SET_TIME]);
|
||||||
subscribe(subscr[MQTT_SUBS_SYNC_NTP]);
|
|
||||||
//subscribe("status/#");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDisconnect(espMqttClientTypes::DisconnectReason reason) {
|
void onDisconnect(espMqttClientTypes::DisconnectReason reason) {
|
||||||
|
@ -358,11 +359,15 @@ class PubMqtt {
|
||||||
DynamicJsonDocument json(128);
|
DynamicJsonDocument json(128);
|
||||||
JsonObject root = json.to<JsonObject>();
|
JsonObject root = json.to<JsonObject>();
|
||||||
|
|
||||||
|
bool limitAbs = false;
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
char *pyld = new char[len + 1];
|
char *pyld = new char[len + 1];
|
||||||
strncpy(pyld, (const char*)payload, len);
|
strncpy(pyld, (const char*)payload, len);
|
||||||
pyld[len] = '\0';
|
pyld[len] = '\0';
|
||||||
root["val"] = atoi(pyld);
|
root[F("val")] = atoi(pyld);
|
||||||
|
DPRINTLN(DBG_INFO, String(pyld) + " " + String(len));
|
||||||
|
if(pyld[len-1] == 'W')
|
||||||
|
limitAbs = true;
|
||||||
delete[] pyld;
|
delete[] pyld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,8 +382,17 @@ class PubMqtt {
|
||||||
tmp[pos] = '\0';
|
tmp[pos] = '\0';
|
||||||
switch(elm++) {
|
switch(elm++) {
|
||||||
case 1: root[F("path")] = String(tmp); break;
|
case 1: root[F("path")] = String(tmp); break;
|
||||||
case 2: root[F("cmd")] = String(tmp); break;
|
case 2:
|
||||||
case 3: root[F("id")] = atoi(tmp); break;
|
if(strncmp("limit", tmp, 5) == 0) {
|
||||||
|
if(limitAbs)
|
||||||
|
root[F("cmd")] = F("limit_nonpersistent_absolute");
|
||||||
|
else
|
||||||
|
root[F("cmd")] = F("limit_nonpersistent_relative");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
root[F("cmd")] = String(tmp);
|
||||||
|
break;
|
||||||
|
case 3: root[F("id")] = atoi(tmp); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if('\0' == p[pos])
|
if('\0' == p[pos])
|
||||||
|
@ -389,9 +403,9 @@ class PubMqtt {
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*char out[128];
|
char out[128];
|
||||||
serializeJson(root, out, 128);
|
serializeJson(root, out, 128);
|
||||||
DPRINTLN(DBG_INFO, "json: " + String(out));*/
|
DPRINTLN(DBG_INFO, "json: " + String(out));
|
||||||
(mSubscriptionCb)(root);
|
(mSubscriptionCb)(root);
|
||||||
|
|
||||||
mRxCnt++;
|
mRxCnt++;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2023 Ahoy, https://ahoydtu.de
|
// 2023 Ahoy, https://ahoydtu.de
|
||||||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
|
// Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __PUB_MQTT_DEFS_H__
|
#ifndef __PUB_MQTT_DEFS_H__
|
||||||
|
@ -84,21 +84,11 @@ const char* const subtopics[] PROGMEM = {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MQTT_SUBS_LMT_PERI_REL,
|
MQTT_SUBS_SET_TIME
|
||||||
MQTT_SUBS_LMT_PERI_ABS,
|
|
||||||
MQTT_SUBS_LMT_NONPERI_REL,
|
|
||||||
MQTT_SUBS_LMT_NONPERI_ABS,
|
|
||||||
MQTT_SUBS_SET_TIME,
|
|
||||||
MQTT_SUBS_SYNC_NTP
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* const subscr[] PROGMEM = {
|
const char* const subscr[] PROGMEM = {
|
||||||
"ctrl/limit_persistent_relative",
|
"setup/set_time"
|
||||||
"ctrl/limit_persistent_absolute",
|
|
||||||
"ctrl/limit_nonpersistent_relative",
|
|
||||||
"ctrl/limit_nonpersistent_absolute",
|
|
||||||
"setup/set_time",
|
|
||||||
"setup/sync_ntp"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*__PUB_MQTT_DEFS_H__*/
|
#endif /*__PUB_MQTT_DEFS_H__*/
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>{#VERSION_GIT}</li>
|
<li>{#VERSION_GIT}</li>
|
||||||
<li id="esp_type"></li>
|
<li id="esp_type"></li>
|
||||||
<li><a href="https://creativecommons.org/licenses/by-nc-sa/3.0/de" target="_blank" >CC BY-NC-SA 3.0</a></li>
|
<li><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed" target="_blank" >CC BY-NC-SA 4.0</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue