ESP-8266 gateway with sensor can't communicate with controller
-
hi everybody,
I've read a lot of topics but can't seem to find out what i'm doing wrong.
I've a wemos D1 mini with a switch connected to it and i want to send the state of this switch to Home Assistant
The following code is running on my d1:#include <EEPROM.h> #include <SPI.h> #include <Bounce2.h> // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "xxxxxxx" #define MY_ESP8266_PASSWORD "xxxxxxx" // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_ADDRESS 192,168,0,9 #define MY_IP_GATEWAY_ADDRESS 192,168,0,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 #define CHILD_ID 1 #define BUTTON_PIN 0 // Arduino Digital I/O pin for button/reed switch #include <ESP8266WiFi.h> #include <MySensors.h> Bounce debouncer = Bounce(); int oldValue=-1; bool initialValueSent = false; MyMessage msg(CHILD_ID,V_STATUS); void setup() { pinMode(BUTTON_PIN,INPUT_PULLUP); // Activate internal pull-up //digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); } void presentation() { // Present locally attached sensors here Serial.println("Presentation:"); // Send the sketch version information to the gateway and Controller sendSketchInfo("Switch", "1.1"); present(CHILD_ID, S_BINARY); } void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value Serial.println(value); send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } // Send locally attached sensors data here } void receive(const MyMessage &message) { if (message.isAck()) { Serial.println("This is an ack from gateway"); } Serial.println("something was received: "+ message.type); }and got follwing output
0;255;3;0;9;Starting gateway (R-NGE-, 2.0.0) scandone f 0, scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 3 cnt connected with telenet-CED24D5, channel 11 ip:192.168.0.9,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.9 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1 1 pm open,type:2 0and in home assistant i get following in the debug:
16-12-31 11:45:08 mysensors.mysensors: Trying to connect to ('192.168.0.9', 5003) 16-12-31 11:45:08 mysensors.mysensors: Connected to ('192.168.0.9', 5003) 16-12-31 11:45:09 netdisco.service: Scanning 16-12-31 11:45:09 mysensors.mysensors: Received 0;255;3;0;14;Gateway startup complete. 0;255;3;0;11;Switch 0;255;3;0;12;1.1 0;1;0;0;3; 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown, will not add child 1. 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19;can someone help me getting this working
-
hi everybody,
I've read a lot of topics but can't seem to find out what i'm doing wrong.
I've a wemos D1 mini with a switch connected to it and i want to send the state of this switch to Home Assistant
The following code is running on my d1:#include <EEPROM.h> #include <SPI.h> #include <Bounce2.h> // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "xxxxxxx" #define MY_ESP8266_PASSWORD "xxxxxxx" // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_ADDRESS 192,168,0,9 #define MY_IP_GATEWAY_ADDRESS 192,168,0,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 #define CHILD_ID 1 #define BUTTON_PIN 0 // Arduino Digital I/O pin for button/reed switch #include <ESP8266WiFi.h> #include <MySensors.h> Bounce debouncer = Bounce(); int oldValue=-1; bool initialValueSent = false; MyMessage msg(CHILD_ID,V_STATUS); void setup() { pinMode(BUTTON_PIN,INPUT_PULLUP); // Activate internal pull-up //digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); } void presentation() { // Present locally attached sensors here Serial.println("Presentation:"); // Send the sketch version information to the gateway and Controller sendSketchInfo("Switch", "1.1"); present(CHILD_ID, S_BINARY); } void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value Serial.println(value); send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } // Send locally attached sensors data here } void receive(const MyMessage &message) { if (message.isAck()) { Serial.println("This is an ack from gateway"); } Serial.println("something was received: "+ message.type); }and got follwing output
0;255;3;0;9;Starting gateway (R-NGE-, 2.0.0) scandone f 0, scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 3 cnt connected with telenet-CED24D5, channel 11 ip:192.168.0.9,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.9 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1 1 pm open,type:2 0and in home assistant i get following in the debug:
16-12-31 11:45:08 mysensors.mysensors: Trying to connect to ('192.168.0.9', 5003) 16-12-31 11:45:08 mysensors.mysensors: Connected to ('192.168.0.9', 5003) 16-12-31 11:45:09 netdisco.service: Scanning 16-12-31 11:45:09 mysensors.mysensors: Received 0;255;3;0;14;Gateway startup complete. 0;255;3;0;11;Switch 0;255;3;0;12;1.1 0;1;0;0;3; 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown, will not add child 1. 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19;can someone help me getting this working
-
hi everybody,
I've read a lot of topics but can't seem to find out what i'm doing wrong.
I've a wemos D1 mini with a switch connected to it and i want to send the state of this switch to Home Assistant
The following code is running on my d1:#include <EEPROM.h> #include <SPI.h> #include <Bounce2.h> // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "xxxxxxx" #define MY_ESP8266_PASSWORD "xxxxxxx" // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_ADDRESS 192,168,0,9 #define MY_IP_GATEWAY_ADDRESS 192,168,0,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 #define CHILD_ID 1 #define BUTTON_PIN 0 // Arduino Digital I/O pin for button/reed switch #include <ESP8266WiFi.h> #include <MySensors.h> Bounce debouncer = Bounce(); int oldValue=-1; bool initialValueSent = false; MyMessage msg(CHILD_ID,V_STATUS); void setup() { pinMode(BUTTON_PIN,INPUT_PULLUP); // Activate internal pull-up //digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); } void presentation() { // Present locally attached sensors here Serial.println("Presentation:"); // Send the sketch version information to the gateway and Controller sendSketchInfo("Switch", "1.1"); present(CHILD_ID, S_BINARY); } void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value Serial.println(value); send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } // Send locally attached sensors data here } void receive(const MyMessage &message) { if (message.isAck()) { Serial.println("This is an ack from gateway"); } Serial.println("something was received: "+ message.type); }and got follwing output
0;255;3;0;9;Starting gateway (R-NGE-, 2.0.0) scandone f 0, scandone state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 3 cnt connected with telenet-CED24D5, channel 11 ip:192.168.0.9,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.9 0;255;3;0;9;No registration required 0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1 1 pm open,type:2 0and in home assistant i get following in the debug:
16-12-31 11:45:08 mysensors.mysensors: Trying to connect to ('192.168.0.9', 5003) 16-12-31 11:45:08 mysensors.mysensors: Connected to ('192.168.0.9', 5003) 16-12-31 11:45:09 netdisco.service: Scanning 16-12-31 11:45:09 mysensors.mysensors: Received 0;255;3;0;14;Gateway startup complete. 0;255;3;0;11;Switch 0;255;3;0;12;1.1 0;1;0;0;3; 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown 16-12-31 11:45:09 mysensors.mysensors: Requesting new presentation for node 0 16-12-31 11:45:09 mysensors.mysensors: Node 0 is unknown, will not add child 1. 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19; 16-12-31 11:45:09 mysensors.mysensors: Sending 0;255;3;0;19;can someone help me getting this working
Mysensors 2.0 has a bug that leads to gateways without radio to not present themselves, which is why node 0 (gateway) is unknown in your log. This is fixed in mysensors 2.1.
-
Mysensors 2.0 has a bug that leads to gateways without radio to not present themselves, which is why node 0 (gateway) is unknown in your log. This is fixed in mysensors 2.1.
I've upgraded and everything works now thank you very much
-
I've upgraded and everything works now thank you very much
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login