Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
1 change: 1 addition & 0 deletions Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* Telegram
* PushOver
* IFTTT
* HomeAssistant
* Sensors support
* DHT 11/22
* Analog
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Please use discord : [![discord](https://img.shields.io/discord/7528221487955969
- Pushover support come from https://github.com/ArduinoHannover/Pushover
- Email support come from https://github.com/CosmicBoris/ESP8266SMTP and https://www.electronicshub.org/send-an-email-using-esp8266/
- Telegram support come from https://medium.com/@xabaras/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968
- HomeAssistant support come from https://developers.home-assistant.io/docs/api/rest/

# Credits: libraries

Expand Down
76 changes: 38 additions & 38 deletions docs/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,44 +179,44 @@ label can be: light/framesize/quality/contrast/brightness/saturation/gainceiling
ESP_TELNET_ON 329 //1 byte = flag
ESP_WEBSOCKET_ON 330 //1 byte = flag
ESP_SD_SPEED_DIV 331 //1 byte = flag
ESP_NOTIFICATION_TOKEN1 332 //64 bytes 63+1 = string ; warning does not support multibyte char like chinese
ESP_NOTIFICATION_TOKEN2 396 //64 bytes 63+1 = string ; warning does not support multibyte char like chinese
ESP_SENSOR_TYPE 460 //1 bytes = flag
ESP_TARGET_FW 461 //1 bytes = flag
FREE 462 //1 bytes = flag
FREE 463 //1 bytes = flag
ESP_TIME_SERVER1 464 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_TIME_SERVER2 593 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_TIME_SERVER3 722 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_REMOTE_SCREEN 851 //1 bytes = flag
ESP_SD_MOUNT 852 //1 bytes = flag
ESP_SESSION_TIMEOUT 853 //1 bytes = flag
FREE FLAG 854 //1 bytes = flag
ESP_SD_CHECK_UPDATE_AT_BOOT 855//1 bytes = flag
ESP_NOTIFICATION_SETTINGS 856 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_CALIBRATION_1 985 //4 bytes = int
ESP_CALIBRATION_2 989 //4 bytes = int
ESP_CALIBRATION_3 993 //4 bytes = int
ESP_CALIBRATION_4 997 //4 bytes = int
ESP_CALIBRATION_5 1001 //4 bytes = int
ESP_SETUP 1005 //1 byte = flag
FREE 1006 //1 byte = flag
FREE 1007 //1 byte = flag
FREE 1008 //1 byte = flag
ESP_FTP_CTRL_PORT 1009 //4 bytes = int
ESP_FTP_DATA_ACTIVE_PORT 1013 //4 bytes = int
ESP_FTP_DATA_PASSIVE_PORT 1017 //4 bytes = int
ESP_FTP_ON 1021 //1 byte = flag
ESP_AUTO_NOTIFICATION 1022 //1 byte = flag
ESP_VERBOSE_BOOT 1023 //1 byte = flag
ESP_WEBDAV_ON 1024 //1 byte = flag
ESP_WEBDAV_PORT 1025 //4 bytes = int
ESP_STA_DNS_VALUE 1029 //4 bytes= int
ESP_SECURE_SERIAL 1033 //1 byte = flag
ESP_SERIAL_BRIDGE_ON 1036 //1 byte = flag
FREE 1037 //1 byte = flag
ESP_SERIAL_BRIDGE_BAUD 1038 //4 bytes= int
ESP_TIME_ZONE 1042 //7 bytes= string
ESP_NOTIFICATION_TOKEN1 332 //251 bytes 250+1 = string ; warning does not support multibyte char like chinese
ESP_NOTIFICATION_TOKEN2 583 //64 bytes 63+1 = string ; warning does not support multibyte char like chinese
ESP_SENSOR_TYPE 647 //1 bytes = flag
ESP_TARGET_FW 648 //1 bytes = flag
FREE 649 //1 bytes = flag
FREE 650 //1 bytes = flag
ESP_TIME_SERVER1 651 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_TIME_SERVER2 780 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_TIME_SERVER3 909 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_REMOTE_SCREEN 1038 //1 bytes = flag
ESP_SD_MOUNT 1039 //1 bytes = flag
ESP_SESSION_TIMEOUT 1040 //1 bytes = flag
FREE FLAG 1041 //1 bytes = flag
ESP_SD_CHECK_UPDATE_AT_BOOT 1042//1 bytes = flag
ESP_NOTIFICATION_SETTINGS 1043 //129 bytes 128+1 = string ; warning does not support multibyte char like chinese
ESP_CALIBRATION_1 1172 //4 bytes = int
ESP_CALIBRATION_2 1176 //4 bytes = int
ESP_CALIBRATION_3 1180 //4 bytes = int
ESP_CALIBRATION_4 1184 //4 bytes = int
ESP_CALIBRATION_5 1188 //4 bytes = int
ESP_SETUP 1192 //1 byte = flag
FREE 1193 //1 byte = flag
FREE 1194 //1 byte = flag
FREE 1195 //1 byte = flag
ESP_FTP_CTRL_PORT 1196 //4 bytes = int
ESP_FTP_DATA_ACTIVE_PORT 1200 //4 bytes = int
ESP_FTP_DATA_PASSIVE_PORT 1204 //4 bytes = int
ESP_FTP_ON 1208 //1 byte = flag
ESP_AUTO_NOTIFICATION 1209 //1 byte = flag
ESP_VERBOSE_BOOT 1210 //1 byte = flag
ESP_WEBDAV_ON 1211 //1 byte = flag
ESP_WEBDAV_PORT 1212 //4 bytes = int
ESP_STA_DNS_VALUE 1216 //4 bytes= int
ESP_SECURE_SERIAL 1220 //1 byte = flag
ESP_SERIAL_BRIDGE_ON 1223 //1 byte = flag
FREE 1224 //1 byte = flag
ESP_SERIAL_BRIDGE_BAUD 1225 //4 bytes= int
ESP_TIME_ZONE 1229 //7 bytes= string
```

* Get/Set Check update at boot state which can be ON, OFF
Expand Down
2 changes: 1 addition & 1 deletion docs/esp3dcnf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ FTP_Passive_Port = 55600
#Auto notification
AUTONOTIFICATION = Yes

#Notification type None / PushOver / Line / Email / Telegram /IFTTT
#Notification type None / PushOver / Line / Email / Telegram / IFTTT / HomeAssistant
NOTIF_TYPE = None

#Notification token 1 string of 64 chars max
Expand Down
2 changes: 2 additions & 0 deletions docs/espXXX.md
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,7 @@ Passwords are not displayed and replaced by `********`
{"line":"3"},
{"telegram":"4"},
{"IFTTT":"5"}]},
{"HomeAssistant":"6"}]},
{"F":"service/notification","P":"332","T":"S","R":"1","V":"********","S":"63","H":"t1","M":"0"},
{"F":"service/notification","P":"396","T":"S","R":"1","V":"********","S":"63","H":"t2","M":"0"},
{"F":"service/notification","P":"856","T":"S","R":"1","V":" ","S":"128","H":"ts","M":"0"},
Expand Down Expand Up @@ -2275,6 +2276,7 @@ can be in JSON or plain text
- LINE
- TELEGRAM
- IFTTT (by webhook)
- HomeAssistant (via webhook)

* T1
* if T1 is not empty, it will set the token1 which depend on [type of notification](https://esp3d.io/esp3d/v3.x/documentation/notifications/index.html)
Expand Down
16 changes: 8 additions & 8 deletions embedded/config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@ app.get("/command", function (req, res) {
},
{
F: "service/ftp",
P: "1021",
P: "1208",
T: "B",
V: "1",
H: "enable",
O: [{ no: "0" }, { yes: "1" }],
},
{
F: "service/ftp",
P: "1009",
P: "1196",
T: "I",
V: "21",
H: "control port",
Expand All @@ -346,7 +346,7 @@ app.get("/command", function (req, res) {
},
{
F: "service/ftp",
P: "1013",
P: "1200",
T: "I",
V: "20",
H: "active port",
Expand All @@ -355,7 +355,7 @@ app.get("/command", function (req, res) {
},
{
F: "service/ftp",
P: "1017",
P: "1204",
T: "I",
V: "55600",
H: "passive port",
Expand All @@ -364,7 +364,7 @@ app.get("/command", function (req, res) {
},
{
F: "service/notification",
P: "1004",
P: "1191",
T: "B",
V: "1",
H: "auto notif",
Expand All @@ -389,7 +389,7 @@ app.get("/command", function (req, res) {
},
{
F: "service/notification",
P: "396",
P: "583",
T: "S",
V: "********",
S: "63",
Expand All @@ -398,7 +398,7 @@ app.get("/command", function (req, res) {
},
{
F: "service/notification",
P: "855",
P: "1042",
T: "S",
V: " ",
S: "127",
Expand All @@ -407,7 +407,7 @@ app.get("/command", function (req, res) {
},
{
F: "system/system",
P: "461",
P: "648",
T: "B",
V: "40",
H: "targetfw",
Expand Down
2 changes: 1 addition & 1 deletion esp3d/src/core/commands/ESP0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const char* help[] = {
#endif // AUTHENTICATION_FEATURE
#if defined(NOTIFICATION_FEATURE)
"[ESP600](message) - send notification",
"[ESP610]type=(NONE/PUSHOVER/EMAIL/LINE/TELEGRAM/IFTTT) (T1=xxx) (T2=xxx) "
"[ESP610]type=(NONE/PUSHOVER/EMAIL/LINE/TELEGRAM/IFTTT/HOMEASSISTANT) (T1=xxx) (T2=xxx) "
"(TS=xxx) - display/set Notification settings",
"[ESP620]URL=http://XXXXXX - send GET notification",
#endif // NOTIFICATION_FEATURE
Expand Down
6 changes: 3 additions & 3 deletions esp3d/src/core/commands/ESP400.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ const char* FirmwareLabels[] = {"Unknown", "Grbl", "Marlin", "Smoothieware",
const char* FirmwareValues[] = {"0", "10", "20", "40", "50"};
#ifdef NOTIFICATION_FEATURE
const char* NotificationsLabels[] = {"none", "pushover", "email",
"line", "telegram", "ifttt"};
"line", "telegram", "ifttt", "home-assistant"};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for this one to have a dash?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I see no issue


const char* NotificationsValues[] = {"0", "1", "2", "3", "4", "5"};
const char* NotificationsValues[] = {"0", "1", "2", "3", "4", "5", "6"};
#endif // NOTIFICATION_FEATURE

const char* IpModeLabels[] = {"static", "dhcp"};
Expand Down Expand Up @@ -403,7 +403,7 @@ void ESP3DCommands::ESP400(int cmd_params_pos, ESP3DMessage* msg) {

// Token 1
dispatchSetting(json, "service/notification", ESP_NOTIFICATION_TOKEN1, "t1",
nullptr, nullptr, 63, 0, -1, -1, nullptr, true, target,
nullptr, nullptr, 250, 0, -1, -1, nullptr, true, target,
requestId);

// Token 2
Expand Down
2 changes: 1 addition & 1 deletion esp3d/src/core/commands/ESP610.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void ESP3DCommands::ESP610(int cmd_params_pos, ESP3DMessage* msg) {
const char* cmdList[] = {"type=", "T1=", "T2=", "TS="};
uint8_t cmdListSize = sizeof(cmdList) / sizeof(char*);
const char* notificationStr[] = {"NONE", "PUSHOVER", "EMAIL",
"LINE", "TELEGRAM", "IFTTT"};
"LINE", "TELEGRAM", "IFTTT", "HOMEASSISTANT"};
uint8_t notificationStrSize = sizeof(notificationStr) / sizeof(char*);
const ESP3DSettingIndex settingIndex[] = {
ESP_NOTIFICATION_TYPE, ESP_NOTIFICATION_TOKEN1, ESP_NOTIFICATION_TOKEN2,
Expand Down
2 changes: 1 addition & 1 deletion esp3d/src/core/esp3d_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ void ESP3DCommands::execute_internal_command(int cmd, int cmd_params_pos,
ESP600(cmd_params_pos, msg);
break;
// Set/Get Notification settings
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE> T1=<token1> T2=<token2>
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE/HOMEASSISTANT> T1=<token1> T2=<token2>
// TS=<Settings> pwd=<admin password> Get will give type and settings only
// not the protected T1/T2
case 610:
Expand Down
23 changes: 13 additions & 10 deletions esp3d/src/core/esp3d_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "../modules/serial/serial_service.h"

// Current Settings Version
#define CURRENT_SETTINGS_VERSION "ESP3D04"
#define CURRENT_SETTINGS_VERSION "ESP3D05"

// boundaries
#define MAX_SENSOR_INTERVAL 60000
Expand All @@ -65,7 +65,7 @@
#define MIN_BOOT_DELAY 0
#define MIN_NOTIFICATION_TOKEN_LENGTH 0
#define MIN_NOTIFICATION_SETTINGS_LENGTH 0
#define MAX_NOTIFICATION_TOKEN_LENGTH 63
#define MAX_NOTIFICATION_TOKEN_LENGTH 250
#define MAX_NOTIFICATION_SETTINGS_LENGTH 128
#define MAX_SERVER_ADDRESS_LENGTH 128
#define MAX_TIME_ZONE_LENGTH 6
Expand Down Expand Up @@ -160,7 +160,7 @@
#define DEFAULT_TIME_SERVER2 "time.google.com"
#define DEFAULT_TIME_SERVER3 "0.pool.ntp.org"

#define DEFAULT_SETTINGS_VERSION "ESP3D30"
#define DEFAULT_SETTINGS_VERSION "ESP3D31"

// default IP values
#define DEFAULT_STA_IP_VALUE "192.168.0.254"
Expand Down Expand Up @@ -403,7 +403,7 @@ const char *ESP3DSettings::readString(int pos, bool *haserror) {
esp3d_log_e("Error unknow entry %d", pos);
return "";
}
uint8_t size_max = query->size;
size_t size_max = query->size;

#if ESP_SAVE_SETTINGS == SETTINGS_IN_EEPROM
static char *byte_buffer = NULL;
Expand Down Expand Up @@ -476,13 +476,13 @@ const char *ESP3DSettings::readString(int pos, bool *haserror) {

// write a string (array of byte with a 0x00 at the end)
bool ESP3DSettings::writeString(int pos, const char *byte_buffer) {
int size_buffer = strlen(byte_buffer);
size_t size_buffer = strlen(byte_buffer);
const ESP3DSettingDescription *query = getSettingPtr(pos);
if (!query) {
esp3d_log_e("Error unknow entry %d", pos);
return false;
}
uint8_t size_max = query->size;
size_t size_max = query->size;

// check if parameters are acceptable
if (size_max == 0) {
Expand Down Expand Up @@ -775,7 +775,7 @@ bool ESP3DSettings::isValidStringSetting(const char *value,
return false;
}
// only printable char allowed
for (uint i = 0; i < strlen(value); i++) {
for (size_t i = 0; i < strlen(value); i++) {
if (!isPrintable(value[i])) {
return false;
}
Expand All @@ -786,7 +786,7 @@ bool ESP3DSettings::isValidStringSetting(const char *value,
break;
case ESP_HOSTNAME:
// only letter and digit
for (uint i = 0; i < strlen(value); i++) {
for (size_t i = 0; i < strlen(value); i++) {
char c = value[i];
if (!(isdigit(c) || isalpha(c) || c == '-')) {
return false;
Expand All @@ -803,7 +803,7 @@ bool ESP3DSettings::isValidStringSetting(const char *value,
break;
case ESP_ADMIN_PWD:
case ESP_USER_PWD:
for (uint i = 0; i < strlen(value); i++) {
for (size_t i = 0; i < strlen(value); i++) {
if (value[i] == ' ') { // no space allowed
return false;
}
Expand Down Expand Up @@ -931,7 +931,8 @@ bool ESP3DSettings::isValidByteSetting(uint8_t value,
if (value == ESP_NO_NOTIFICATION || value == ESP_PUSHOVER_NOTIFICATION ||
value == ESP_EMAIL_NOTIFICATION || value == ESP_LINE_NOTIFICATION ||
value == ESP_TELEGRAM_NOTIFICATION ||
value == ESP_IFTTT_NOTIFICATION) {
value == ESP_IFTTT_NOTIFICATION ||
value == ESP_HOMEASSISTANT_NOTIFICATION) {
return true;
}

Expand Down Expand Up @@ -1248,6 +1249,8 @@ const ESP3DSettingDescription *ESP3DSettings::getSettingPtr(
// like chinese chars
break;
case ESP_NOTIFICATION_TOKEN1:
setting.size = 250; // 250 bytes
break;
case ESP_NOTIFICATION_TOKEN2:
setting.size = 63; // 63 bytes
break;
Expand Down
Loading