#7 correct limitation of IR sending to 2147483647
This commit is contained in:
1 parent
c7644cf706
commit
2b50a319ae
1 file changed
+15
-13
@@ -2,7 +2,6 @@
|
|||||||
433nIRtoMQTTto433nIR - ESP8266 program for home automation
|
433nIRtoMQTTto433nIR - ESP8266 program for home automation
|
||||||
Tested OK on GeekCreek ESP12F
|
Tested OK on GeekCreek ESP12F
|
||||||
Not working on NodeMCU V0.9
|
Not working on NodeMCU V0.9
|
||||||
|
|
||||||
Act as a wifi gateway between your 433mhz/infrared IR signal and a MQTT broker
|
Act as a wifi gateway between your 433mhz/infrared IR signal and a MQTT broker
|
||||||
Send and receiving command by MQTT
|
Send and receiving command by MQTT
|
||||||
|
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
Contributors:
|
Contributors:
|
||||||
- 1technophile
|
- 1technophile
|
||||||
- crankyoldgit
|
- crankyoldgit
|
||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
- MQTT library (https://github.com/knolleary)
|
- MQTT library (https://github.com/knolleary)
|
||||||
- RCSwitch (https://github.com/sui77/rc-switch)
|
- RCSwitch (https://github.com/sui77/rc-switch)
|
||||||
@@ -24,24 +22,19 @@
|
|||||||
|
|
||||||
Project home: https://github.com/1technophile/433nIRtoMQTTto433nIR_ESP8266
|
Project home: https://github.com/1technophile/433nIRtoMQTTto433nIR_ESP8266
|
||||||
Blog, tutorial: http://1technophile.blogspot.com/2016/09/433nIRtomqttto433nIR-bidirectional-esp8266.html
|
Blog, tutorial: http://1technophile.blogspot.com/2016/09/433nIRtomqttto433nIR-bidirectional-esp8266.html
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
subject to the following conditions:
|
subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
Some usefull commands to test gateway with mosquitto:
|
Some usefull commands to test gateway with mosquitto:
|
||||||
Subscribe to the subject for data receiption from RF signal
|
Subscribe to the subject for data receiption from RF signal
|
||||||
mosquitto_sub -t home/433toMQTT
|
mosquitto_sub -t home/433toMQTT
|
||||||
|
|
||||||
Send data by MQTT to convert it on RF signal
|
Send data by MQTT to convert it on RF signal
|
||||||
mosquitto_pub -t home/MQTTto433/ -m 1315153
|
mosquitto_pub -t home/MQTTto433/ -m 1315153
|
||||||
*/
|
*/
|
||||||
@@ -61,9 +54,9 @@ decode_results results;
|
|||||||
#define TRACE 1 // 0= trace off 1 = trace on
|
#define TRACE 1 // 0= trace off 1 = trace on
|
||||||
|
|
||||||
// Update these with values suitable for your network.
|
// Update these with values suitable for your network.
|
||||||
#define wifi_ssid "wifi ssid"
|
#define wifi_ssid "mywifiid"
|
||||||
#define wifi_password "wifi pwd"
|
#define wifi_password "mypwd"
|
||||||
#define mqtt_server "mqtt server ip adress"
|
#define mqtt_server "192.168.0.22"
|
||||||
#define mqtt_user "your_username" // not compulsory if you set it uncomment line 143 and comment line 145
|
#define mqtt_user "your_username" // not compulsory if you set it uncomment line 143 and comment line 145
|
||||||
#define mqtt_password "your_password" // not compulsory if you set it uncomment line 143 and comment line 145
|
#define mqtt_password "your_password" // not compulsory if you set it uncomment line 143 and comment line 145
|
||||||
|
|
||||||
@@ -300,14 +293,14 @@ void receivingMQTT(String topicNameRec, String callbackstring) {
|
|||||||
trc(topicNameRec);
|
trc(topicNameRec);
|
||||||
char topicOri[26] = "";
|
char topicOri[26] = "";
|
||||||
char topicStrAck[26] = "";
|
char topicStrAck[26] = "";
|
||||||
char datacallback[26] = "";
|
char datacallback[32] = "";
|
||||||
// Acknowledgement inside a subtopic to avoid loop
|
// Acknowledgement inside a subtopic to avoid loop
|
||||||
topicNameRec.toCharArray(topicOri,26);
|
topicNameRec.toCharArray(topicOri,26);
|
||||||
char DataAck[26] = "OK";
|
char DataAck[26] = "OK";
|
||||||
client.publish("home/ack", DataAck);
|
client.publish("home/ack", DataAck);
|
||||||
callbackstring.toCharArray(datacallback,26);
|
callbackstring.toCharArray(datacallback,32);
|
||||||
trc(datacallback);
|
trc(datacallback);
|
||||||
unsigned long data = atol(datacallback);
|
unsigned long data = char2Ulong(datacallback);
|
||||||
trc(String(data));
|
trc(String(data));
|
||||||
|
|
||||||
if (topicNameRec == subjectMQTTto433){
|
if (topicNameRec == subjectMQTTto433){
|
||||||
@@ -339,6 +332,15 @@ void receivingMQTT(String topicNameRec, String callbackstring) {
|
|||||||
irsend.sendSAMSUNG(data, 32);
|
irsend.sendSAMSUNG(data, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long char2Ulong(char *str)
|
||||||
|
{
|
||||||
|
unsigned long result = 0; // Initialize result
|
||||||
|
// Iterate through all characters of input string and update result
|
||||||
|
for (int i = 0; str[i] != '\0'; ++i)
|
||||||
|
result = result*10 + str[i] - '0';
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//send MQTT data dataStr to topic topicNameSend
|
//send MQTT data dataStr to topic topicNameSend
|
||||||
void sendMQTT(String topicNameSend, String dataStr){
|
void sendMQTT(String topicNameSend, String dataStr){
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user