Mysensors ESP8266 GW with relay - Presentation relay not working why?
-
Dear all,
I am trying to use the ESP8266 with a local attached relay , but it is not recognized by domoticz.
Can someone help on that ?Here the information log and the ino code:
DOMOTICZ LOG
2016-01-17 13:49:54.731 MySensors: connected to: 192.168.1.111:5003 2016-01-17 13:49:54.731 MySensors: Gateway Ready... 2016-01-17 13:49:55.781 MySensors: Gateway Version: 1.6.0-beta 2016-01-17 13:49:55.781 MySensors: Gateway Version: 1.6.0-betaESP LOG
connected with FCSSID, channel 1 ip:192.168.1.111,mask:255.255.255.0,gw:192.168.1.1 .IP: 192.168.1.111 start call Setup Start wait End wait End call Setup start call presentation Start wait End wait End call presentation 0;0;3;0;9;Init complete, id=0, parent=0, distance=0 0;0;3;0;9;Client 0 connected 0;0;3;0;9;Client 0: 0;0;3;0;2; 0;0;3;0;9;Client 0: 0;0;3;0;2;Get Version 0;0;3;0;9;Client 0: 0;0;3;0;18;PING 0;0;3;0;9;Client 0: 0;0;3;0;18;PING 0;0;3;0;9;Client 0: 0;0;3;0;18;PING 0;0;3;0;9;Client 0: 0;0;3;0;18;PING 0;0;3;0;9;Client 0: 0;0;3;0;18;PINGINO code:
#include <EEPROM.h> #include <SPI.h> // Enable debug prints to serial monitor #define MY_DEBUG //#define MY_REPEATER_FEATURE #define MY_DEBUG_VERBOSE // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 // Enables and select radio type (if attached) // #define MY_RADIO_NRF24 // #define MY_RADIO_RFM69 // Gateway mode always enabled for ESP8266. But we add this anyway ;) #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "FCSSID" #define MY_ESP8266_PASSWORD "jfsc20100930*" // Enable UDP communication //#define MY_USE_UDP // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,1,111 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,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 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68 /* // Flash leds on rx/tx/err #define MY_LEDS_BLINKING_FEATURE // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 #define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin #define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin #define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED */ #if defined(MY_USE_UDP) #include <WiFiUDP.h> #else #include <ESP8266WiFi.h> #endif // Enable repeater functionality for this node //#define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensor.h> #define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay void setup() { Serial.println("start call Setup"); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } Serial.println("Start wait"); //delay(60000); Serial.println("End wait"); Serial.println("End call Setup"); } void presentation() { Serial.println("start call presentation"); Serial.println("Start wait"); //delay(60000); Serial.println("End wait"); // Send the sketch version information to the gateway and Controller sendSketchInfo("Relay2", "2.0"); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_LIGHT); } Serial.println("End call presentation"); } void loop() { //Serial.println("start call loop"); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
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