Skip to content

Commit f6f6616

Browse files
committed
v5.1.0
5.1.0 20170513 * Fix Offline/Removal of retained topic when FullTopic is changed * Add FullTopic to MQTT Configuration and Information web page * Adde license model GPLv3 (arendst#188)
1 parent 3143b6e commit f6f6616

26 files changed

+1129
-445
lines changed

LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

api/arduino/sonoff.ino.bin

704 Bytes
Binary file not shown.

sonoff/_releasenotes.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
/* 5.0.7 20170511
1+
/* 5.1.0 20170513
2+
* Fix Offline/Removal of retained topic when FullTopic is changed
3+
* Add FullTopic to MQTT Configuration and Information web page
4+
* Adde license model GPLv3 (#188)
5+
*
6+
* 5.0.7 20170511
27
* Fix possible exception 28 on empty command
38
* Add command SetOption0 as replacement for SaveState
49
* Add command SetOption1 as replacement for ButtonRestrict

sonoff/settings.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
/*********************************************************************************************\
2-
* Config settings
3-
\*********************************************************************************************/
1+
/*
2+
settings.h - setting variables for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
419

520
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
621
uint32_t data; // Allow bit manipulation using SetOption

sonoff/settings.ino

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
/*
2-
Copyright (c) 2017 Theo Arends. All rights reserved.
3-
4-
Redistribution and use in source and binary forms, with or without
5-
modification, are permitted provided that the following conditions are met:
6-
7-
- Redistributions of source code must retain the above copyright notice,
8-
this list of conditions and the following disclaimer.
9-
- Redistributions in binary form must reproduce the above copyright notice,
10-
this list of conditions and the following disclaimer in the documentation
11-
and/or other materials provided with the distribution.
12-
13-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23-
POSSIBILITY OF SUCH DAMAGE.
2+
settings.ino - user settings for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
2418
*/
2519

2620
/*********************************************************************************************\

sonoff/sonoff.ino

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
/*
2-
* Sonoff-Tasmota by Theo Arends
3-
*
4-
* ====================================================
5-
* Prerequisites:
6-
* - Change libraries/PubSubClient/src/PubSubClient.h
7-
* #define MQTT_MAX_PACKET_SIZE 512
8-
*
9-
* - Select IDE Tools - Flash size: "1M (no SPIFFS)"
10-
* ====================================================
2+
sonoff.ino - Sonoff-Tasmota firmware for iTead Sonoff, Wemos and NodeMCU hardware
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
/*
21+
====================================================
22+
Prerequisites:
23+
- Change libraries/PubSubClient/src/PubSubClient.h
24+
#define MQTT_MAX_PACKET_SIZE 512
25+
26+
- Select IDE Tools - Flash size: "1M (no SPIFFS)"
27+
====================================================
1128
*/
1229

13-
#define VERSION 0x05000700 // 5.0.7
30+
#define VERSION 0x05010000 // 5.1.0
1431

1532
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
1633
enum week_t {Last, First, Second, Third, Fourth};
@@ -327,11 +344,6 @@ void getTopic_P(char *stopic, byte prefix, char *topic, const char* subtopic)
327344
fulltopic += "/";
328345
}
329346
snprintf_P(stopic, TOPSZ, PSTR("%s%s"), fulltopic.c_str(), romram);
330-
/*
331-
char log[LOGSZ];
332-
snprintf_P(log, sizeof(log), PSTR("MTPC: %s"), stopic);
333-
addLog(LOG_LEVEL_DEBUG, log);
334-
*/
335347
}
336348

337349
char* getStateText(byte state)
@@ -706,8 +718,12 @@ boolean mqtt_command(boolean grpflg, char *type, uint16_t index, char *dataBuf,
706718
if (!strcmp(dataBuf, MQTTClient)) {
707719
payload = 1;
708720
}
709-
strlcpy(sysCfg.mqtt_fulltopic, (1 == payload) ? MQTT_FULLTOPIC : dataBuf, sizeof(sysCfg.mqtt_fulltopic));
710-
restartflag = 2;
721+
strlcpy(stemp1, (1 == payload) ? MQTT_FULLTOPIC : dataBuf, sizeof(stemp1));
722+
if (strcmp(stemp1, sysCfg.mqtt_fulltopic)) {
723+
mqtt_publish_topic_P(2, PSTR("LWT"), (sysCfg.flag.mqtt_offline) ? "Offline" : "", true); // Offline or remove previous retained topic
724+
strlcpy(sysCfg.mqtt_fulltopic, stemp1, sizeof(sysCfg.mqtt_fulltopic));
725+
restartflag = 2;
726+
}
711727
}
712728
snprintf_P(svalue, ssvalue, PSTR("{\"FullTopic\":\"%s\"}"), sysCfg.mqtt_fulltopic);
713729
}

sonoff/sonoff_template.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
/*********************************************************************************************\
2-
* Template parameters
3-
\*********************************************************************************************/
1+
/*
2+
sonoff_template.h - template settings for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
419

520
// User selectable GPIO functionality
621
enum upins_t {

sonoff/support.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
support.h - parameters used by platformio for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#ifdef __cplusplus
221
extern "C" {
322
#endif

sonoff/support.ino

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
/*
2-
Copyright (c) 2017 Theo Arends. All rights reserved.
3-
4-
Redistribution and use in source and binary forms, with or without
5-
modification, are permitted provided that the following conditions are met:
6-
7-
- Redistributions of source code must retain the above copyright notice,
8-
this list of conditions and the following disclaimer.
9-
- Redistributions in binary form must reproduce the above copyright notice,
10-
this list of conditions and the following disclaimer in the documentation
11-
and/or other materials provided with the distribution.
12-
13-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23-
POSSIBILITY OF SUCH DAMAGE.
2+
support.ino - support for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
2418
*/
2519

2620
const char JSON_SNS_TEMPHUM[] PROGMEM =

sonoff/user_config.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
/*
2+
user_config.h - user specific configuration for Sonoff-Tasmota
3+
4+
Copyright (C) 2017 Theo Arends
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
/*********************************************************************************************\
2-
* User specific configuration parameters
3-
*
421
* ATTENTION: Changes to most PARAMETER defines will only override flash settings if you change
522
* define CFG_HOLDER.
623
* Most parameters can be changed online using commands via MQTT, WebConsole or serial

0 commit comments

Comments
 (0)