@hek I am using Stable ESP8266 version 2.0.0 from stable release
Posts made by vickey
-
RE: Guide: Setting up and testing MQTT Client Gateway
-
RE: nodered "injected" between domoticz and mysensors
@tbowmo May you please share your node-red set up by exporting your setup as flow? If feasible for you
-
RE: Guide: Setting up and testing MQTT Client Gateway
I tried to make MQTT client gateway but it is giving following error while compiling
C:\Users\Ahmed\AppData\Local\Temp\build8359488613260197686.tmp/arduino.ar(core_esp8266_postmortem.c.o): In function `abort': C:\Users\Ahmed\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc2\cores\esp8266/core_esp8266_postmortem.c:177: multiple definition of `abort' GatewayESP8266MQTTClient.cpp.o:C:\Users\Ahmed\Documents\Arduino\libraries\MySensors/core/MyMainESP8266.cpp:46: first defined here collect2.exe: error: ld returned 1 exit status Error compiling.
Any suggestions @hek ?
-
RE: ESP8266 WiFi gateway port for MySensors
Hi.
I am having an issue with my ESP8266 gateway. I have tried all versions of mysensors including developmental versions, but my esp8266 does not show any serial debug, nor it gets connected to my router. I also enabled debug in configuration file. When I install AT firmware, it replies to AT command, it also works with nodemcu firmware, but it does not respond with Arduino firmware. May someone help me? -
RE: Openhab, Mosquitto, ESP-8266 12E wifi gateway
And how did you configure domoticz? Did you use "Mysensors gateway with lan interface" type in hardware section or anything else? And may you send me the library files you used (I mean that complete zip which worked for you).
-
RE: ESP8266 MySensors Gateway Crashes when Node Connects
I am using mysensor 1.5.1 ESP8266 mysensor gateway. But It is not starting up. I am using 2A power supply. Here is the log.
ESP8266 MySensors Gateway Connecting to Ahmed ............Connected! IP: 192.168.0.31 ctx: cont sp: 3ffebcb0 end: 3ffec010 offset: 01b0 >>>stack>>> 3ffebe60: 3ffea8af 000000ff 3ffea940 40205384 3ffebe70: 3ffea8af 00000030 3ffea940 402053d0 3ffebe80: a8e1fc0a 000000a8 3ffea940 40205587 3ffebe90: 3ffea8af 0000000a 3ffea940 40204dd7 3ffebea0: 3fff1e58 4024371c 3fff235c 0000000a 3ffebeb0: 000000ff 3ffea8a8 3ffea8af 40203c7d 3ffebec0: 3ffec070 00000001 3ffebf2f 4020c5a8 3ffebed0: 402421c0 00000001 00000001 3ffec070 3ffebee0: 00000033 0000000a 3ffec070 4020b6e1 3ffebef0: 3ffebf2e 40243cbc 3fff1e58 0000000a 3ffebf00: 000000ff 00000000 0000000d 4020335e 3ffebf10: 40217e00 3ffead34 3ffe9390 3ffe93a4 3ffebf20: 00000065 3ffea940 3ffebf65 40203379 3ffebf30: 00000000 3ffea940 3ffea94a 0000000a 3ffebf40: 000000ff 00000000 3ffea8a8 40203f38 3ffebf50: 0000001d 3ffea8af 3ffea940 402053bc 3ffebf60: 3ffe92f8 a8e1fc0a 3ffea940 00000001 3ffebf70: 00000001 00000000 3ffea8a8 402040b0 3ffebf80: 00000001 0000000a 3ffea8a8 4020422b 3ffebf90: 00000000 0000000a 3ffea8a8 40204381 3ffebfa0: 0000007f 3ffec03c 40201cac 3ffeaff0 3ffebfb0: 40202320 00000001 0000000a 40201d4f 3ffebfc0: 1f00a8c0 00ffffff 0100a8c0 3ffec03c 3ffebfd0: 3ffe9328 3ffead34 3ffec070 402026ef 3ffebfe0: 3ffe98a8 1f00a8c0 00000000 00000000 3ffebff0: 3fffdc20 00000000 3ffec034 40201d1f 3ffec000: 00000000 00000000 3ffeaff0 40100398 <<<stack<<< ets Jan 8 2013,rst cause:1, boot mode:(3,7) load 0x4010f000, len 1264, room 16 tail 0 chksum 0x42 csum 0x42 ~ld
May someone help me?
-
RE: Openhab, Mosquitto, ESP-8266 12E wifi gateway
This is what I have done already but failed.
I get following error in my ESP-8266 Gateway debug
ESP8266 MySensors Gateway Connecting to Ahmed .............Connected! IP: 192.168.0.31 ctx: cont sp: 3ffebcb0 end: 3ffec010 offset: 01b0 >>>stack>>> 3ffebe60: 3ffea8af 000000ff 3ffea940 40205384 3ffebe70: 3ffea8af 00000030 3ffea940 402053d0 3ffebe80: a8e1fc0a 000000a8 3ffea940 40205587 3ffebe90: 3ffea8af 0000000a 3ffea940 40204dd7 3ffebea0: 0000001f ffffffff 40201c55 0000000a 3ffebeb0: 000000ff 3ffea8a8 3ffea8af 40203c7d 3ffebec0: 00000000 ffdfffff ffffffff 3fffc6fc 3ffebed0: 00000001 3ffeaff0 00000000 3fffdc20 3ffebee0: 3ffec03c 00000030 3ffec070 4020b6e1 3ffebef0: 3ffebf2e 40243cbc 3fff1e58 0000000a 3ffebf00: 000000ff 00000000 0000000d 4020335e 3ffebf10: 40217e00 3ffead34 3ffe9390 3ffe93a4 3ffebf20: 00000065 3ffea940 3ffebf65 40203379 3ffebf30: 00000000 3ffea940 3ffea94a 0000000a 3ffebf40: 000000ff 00000000 3ffea8a8 40203f38 3ffebf50: 0000001d 3ffea8af 3ffea940 402053bc 3ffebf60: 3ffe92f8 a8e1fc0a 3ffea940 00000001 3ffebf70: 00000001 00000000 3ffea8a8 402040b0 3ffebf80: 00000001 0000000a 3ffea8a8 4020422b 3ffebf90: 00000000 0000000a 3ffea8a8 40204381 3ffebfa0: 0000007f 3ffec03c 40201cac 3ffeaff0 3ffebfb0: 40202320 00000001 0000000a 40201d4f 3ffebfc0: 1f00a8c0 00ffffff 0100a8c0 3ffec03c 3ffebfd0: 3ffe9328 3ffead34 3ffec070 402026ef 3ffebfe0: 3ffe98a8 1f00a8c0 00000000 00000000 3ffebff0: 3fffdc20 00000000 3ffec034 40201d1f 3ffec000: 00000000 00000000 3ffeaff0 40100398 <<<stack<<< ets Jan 8 2013,rst cause:1, boot mode:(3,3) load 0x4010f000, len 1264, room 16 tail 0 chksum 0x42 csum 0x42 ~ld
-
RE: Openhab, Mosquitto, ESP-8266 12E wifi gateway
@luisgcu I am also new to this kind of stuff. I tried Domoticz but failed to get my ESP8266 gateway working. May you share your setup? Did you use Mysensors library or lua scripts?
-
RE: Interrupt, Perform a specific function, not the loop
@AWI This code runs continuously for 5 seconds in order to get a stable reading of light using LDR, which is used to set night mode on and off.
-
RE: Interrupt, Perform a specific function, not the loop
Here is my sketch if someone finds it useful. It uses LDR to set night mode in low light conditions and vice versa, door reed switch and PIR sensor to turn ac or dc lights with the help of two channel relay and EasyIOT as server. Interrupts perform the functions of turning lights on and off while timer wake up decides the night mode implementation. Moreover, sensor node sleeps most of its time to conserve the battery.
#include <SPI.h> #include <MySensor.h> #define CHILD_ID_LIGHT 0 #define CHILD_ID_DOOR 1 #define CHILD_ID_PIR 2 #define CHILD_ID_LED 3 #define CHILD_ID_SAVER 4 #define LDR_PIN A0 #define DOOR_PIN 2 #define PIR_PIN 3 #define LED_PIN 4 // Relay 1 is attached #define SAVER_PIN 5 // Relay 2 is attached #define INTERRUPT DOOR_PIN-2 unsigned long SLEEP_TIME = 1200000; // Sleep time 1200000 i.e. 20 minutes (in milliseconds) MySensor gw; boolean activity = false; boolean LEDSwitch = false; boolean SaverSwitch = false; boolean nightSwitch = false; MyMessage msgLDR(CHILD_ID_LIGHT, V_LIGHT_LEVEL); MyMessage msgDoor(CHILD_ID_DOOR, V_TRIPPED); MyMessage msgPir(CHILD_ID_PIR, V_TRIPPED); void setup() { gw.begin(NULL, AUTO, false, 1); gw.sendSketchInfo("BedRoom", "1.2"); pinMode(DOOR_PIN,INPUT); pinMode(PIR_PIN,INPUT); pinMode(LED_PIN, OUTPUT); pinMode(SAVER_PIN, OUTPUT); digitalWrite(DOOR_PIN, HIGH); digitalWrite(PIR_PIN, HIGH); digitalWrite(LED_PIN, HIGH); digitalWrite(SAVER_PIN, HIGH); gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); gw.present(CHILD_ID_DOOR, S_DOOR); gw.present(CHILD_ID_PIR, S_MOTION); int LightLevel; for(int i = millis(); i < (millis() + 5000); i++){ LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23)); } if(LightLevel < 20){ gw.send(msgLDR.set(LightLevel)); nightSwitch = true; } else { gw.send(msgLDR.set(LightLevel)); nightSwitch = false; } } void loop() { if(nightSwitch){ //When night switch is on int wake; wake = gw.sleep(INTERRUPT,FALLING, SLEEP_TIME); if(wake == 1){ if(!activity){ gw.send(msgDoor.set("1")); gw.send(msgDoor.set("0")); activity = true; if((!LEDSwitch) && (!SaverSwitch)){ pirswitch(); } else{ //activity finished activityoff(); } } } else{ //Timer wake up int LightLevel; if((!LEDSwitch) && (!SaverSwitch)){ for(int i = millis(); i < (millis() + 5000); i++){ LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23)); } } else{ for(int i = millis(); i < (millis() + 1000); i++){ LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23)); } } if((LightLevel < 10) && ((!LEDSwitch) && (SaverSwitch))){ Serial.println("Light level is less than 50%, Turning LED on"); digitalWrite(LED_PIN, LOW); LEDSwitch = true; SLEEP_TIME = 7200000; // Sleep time changed to 2 hours } else if((LightLevel > 20) && ((!LEDSwitch) && (!SaverSwitch))){ gw.send(msgLDR.set(LightLevel)); nightSwitch = false; SLEEP_TIME = 7200000; // Sleep time changed to 2 hours gw.sleep(SLEEP_TIME); } else if((LightLevel > 5) && (nightSwitch) && ((!LEDSwitch) && (!SaverSwitch))){ gw.send(msgLDR.set(LightLevel)); SLEEP_TIME = 600000; // Sleep time changed to 10 minutes } } } else { //When night switch is off int LightLevel; for(int i = millis(); i < (millis() + 5000); i++){ LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23)); } if(LightLevel < 20){ gw.send(msgLDR.set(LightLevel)); nightSwitch = true; SLEEP_TIME = 7200000; // Sleep time changed to 2 hours gw.sleep(INTERRUPT,FALLING, SLEEP_TIME); } else if((LightLevel < 30) && (!nightSwitch)){ SLEEP_TIME = 600000; // Sleep time changed to 10 minutes gw.sleep(SLEEP_TIME); } else if((LightLevel < 50) && (!nightSwitch)){ SLEEP_TIME = 1800000; // Sleep time changed to 30 minutes gw.sleep(SLEEP_TIME); } } } void pirswitch() { for(int i = millis(); i < (millis() + 5000); i++){ //Check PIR for activity 10 times with delay of half second boolean tripped = digitalRead(PIR_PIN) == HIGH; Serial.println(i); if(tripped){ gw.send(msgPir.set(tripped?"1":"0")); Serial.println("Motion detected"); //activity on function activityon(); Serial.println("Loop terminated"); break; } } delay(3000); activity = false; } void activityon() { //turn saver on digitalWrite(SAVER_PIN, LOW); SaverSwitch = true; Serial.println("Energy saver turned on"); int LightLevel; for(int i = millis(); i < (millis() + 1000); i++){ //Check if energy saver is on LightLevel = (100 - ((1023-analogRead(LDR_PIN))/10.23)); } if(LightLevel < 10){ Serial.println("Light level is less than 50%, Turning LED on"); digitalWrite(LED_PIN, LOW); LEDSwitch = true; } else{ SLEEP_TIME = 1000; Serial.println("Sleep time changed to second"); } } void activityoff() { delay(3000); //turn off saver or LED digitalWrite(SAVER_PIN, HIGH); digitalWrite(LED_PIN, HIGH); Serial.println("Activity finished"); SaverSwitch = false; LEDSwitch = false; activity = false; SLEEP_TIME = 7200000; Serial.println("Sleep time changed to 2 hours"); }
-
RE: Interrupt, Perform a specific function, not the loop
I have tried it with single interrupt and It is working good so far on my mysensors 1.4 version. In case of interrupt
wake = gw.sleep(INTERRUPT,FALLING, SLEEP_TIME);
I use wake value (wake == 1) for function related to interrupt and use else condition for function related to timer wake up.
-
RE: Interrupt, Perform a specific function, not the loop
@martinhjelmare Thank you so much buddy for the help. I have not tested it yet. Can I use it with mysensors 1.4 version? Because I am using easyiot as controller and it uses 1.4 version.
-
Interrupt, Perform a specific function, not the loop
Hi. I have a node which sleeps most of the time and It has interrupt function enabled. But I want to perform a specific function when Node awake from sleep through interrupt pin 2, not the loop and again it should go to sleep using gw.sleep command. Is it possible to perform that specific function on an interrupt?
https://www.arduino.cc/en/Reference/AttachInterrupt describes what I need but I want to implement sleep function of mysensors also.
May someone please help me?
-
RE: GatewayESP8266MQTTClient in Development Branch
@hek Gateway and sensor node never get communicated even after configuring manual ID. Here is arduino debug
Starting... find parent send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc: find parent send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc: find parent send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
Here is the ESP8266 12E gateway debug
0;0;3;0;9;Starting... scandone f 0, ....scandone state: 0 -> 2 (b0) .state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Ahmed, channel 1 ip:192.168.0.31,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.31 0;0;3;0;9;gateway started, id=0, parent=0, distance=0 0;0;3;0;9;Attempting MQTT connection... 0;0;3;0;9;MQTT connected
-
RE: ESP8266 WiFi gateway port for MySensors
@hek I have installed GatewayESP8266MQTTClient sketch on my ESP-8266 12E.
Here is sketch I am using#include <EEPROM.h> #include <SPI.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 // Enables and select radio type (if attached) #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_GATEWAY_MQTT_CLIENT // Set this nodes topic prefix #define MY_MQTT_TOPIC_PREFIX "mygateway" // Set MQTT client id #define MY_MQTT_CLIENT_ID "mysensors-1" // Enable these if your MQTT broker requires usenrame/password //#define MY_MQTT_USER "admin" //#define MY_MQTT_PASSWORD "MyPassword" // Set WIFI SSID and password #define MY_ESP8266_SSID "Ahmed" #define MY_ESP8266_PASSWORD "MyPassword" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,0,31 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,0,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // MQTT broker ip address. #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 30 // The MQTT broker port to to open #define MY_PORT 1883 /* // 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 */ #include <ESP8266WiFi.h> #include <MySensor.h> void setup() { } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attech sensors data here }
Here is the debug
0;0;3;0;9;Starting... scandone f 0, ....scandone state: 0 -> 2 (b0) .state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 aid 1 cnt connected with Ahmed, channel 1 ip:192.168.0.31,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.31 0;0;3;0;9;gateway started, id=0, parent=0, distance=0 0;0;3;0;9;Attempting MQTT connection...
And it keeps attempinng for MQTT connection.
I have installed Domoticz on my RPi and added a hardware Mysensors Gateway with LAN interface with remote address i.e. 192.168.0.31 in my case and port 1883. Here is Domoticz log
2015-10-17 12:50:26.675 Hardware Monitor: Fetching data (System sensors) 2015-10-17 12:50:31.590 Error: MySensors: Error: Connection refused 2015-10-17 12:50:31.590 Error: TCP: Error: Connection refused
I don't have mosquitto installed in my Rpi.
May someone suggest me any solution.
-
RE: ESP8266 WiFi gateway port for MySensors
@hek Thanks for the code. I have few questions in my mind. Firstly do I just have to upload this ESP8266MQTTClient.ino sketch on esp8266 12-E model? or does it needs anything to add in the sketch except SSID and password? I want to use ESP-8266-E and NRF24L01+ as gateway for openhab. If it is possible then, do I have to adopt the same procedure for configuring openhab as ethernet gateway? Secondly, Can I make two gateways using this sketch, is this possible? As I want to add sensors which are 500 meters away at my farmhouse.
-
RE: Openhab, Mosquitto, ESP-8266 12E wifi gateway
@Yveaux. I tried a lot but could not found any way how to use your bridge. How to run this bridge on rpi? May you please give me hints?
-
ESP8266 + NRF24L01+ repeater node
Hi.
I want to increase the range of my existing EasyIOT server. I have wifi setup from my home to my farm using TP-Link 5210 cpe. Can I use ESP-8266 12E and NRF24L01+ as a repeater to my existing EasyIOT server which will be installed on my farm and will help to connect NRF24L01+ based sensor nodes installed on my farm to raspberry pi EasyIOT server installed in my home. Is this possible?
Idea came to me through Esp8266 Gateway example on forum.mysensors.org/topic/1870/esp8266-w...y-port-for-mysensors.
-
RE: Openhab, Mosquitto, ESP-8266 12E wifi gateway
@Yveaux, How to implement your bridge? Is there any wiki stuff related to your bridge?
-
Openhab, Mosquitto, ESP-8266 12E wifi gateway
Hi Friends,
I want to setup openhab using my esp-8266 12E as gateway as described in http://forum.mysensors.org/topic/1870/esp8266-wifi-gateway-port-for-mysensors. May someone help me to accomplish this task?
I am searching on google since a week. I have installed openhab and mosquitto on my raspberry pi. ESP-8266 gateway is also ready. Openhab Demo is also working.
As far as I understand, I have to add following lines to openhab.cfg file;
mqtt:broker.url=tcp://192.168.0.31:5003
mqtt:broker.clientId=openhab192.168.0.31 is the static address I have assigned to my esp-8266 12E through router. 5003 is the port defined in Esp8266Gateway sketch.
Please help me if I have something missing in my setup.
I have few confusions, How openhab will understand the information sent by sensor node? Will it assign ID to my sensors or I have to define the id in gw.begin()? If so then give me an example for this purpose.
-
RE: ESP8266 WiFi gateway port for MySensors
Sorry When I investigate the wiring throughly, MOSI and MISO was interchanged. Now it has started working but error has changed
ESP8266 MySensors Gateway
Connecting to Ahmed
.......Connected!
IP: 192.168.0.31
0;0;3;0;9;gateway started, id=0, parent=0, distance=0
0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
0;0;3;0;9;ver mismatch
0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
0;0;3;0;9;ver mismatchI obtained the code for gateway & MySensors from MySensors repository on github.
what would be the problem now? -
RE: ESP8266 WiFi gateway port for MySensors
I have checked all the wires and every thing is according to as par advised. I am using 2 separate 3.3 v voltage regulator to power up ESP-8266 12E and nrf24L01+ having common ground, using ESP-8266 breakout board without voltage regulator and nrf24l01+ breakout board with 3.3 v regulator powered by 5v supply.
GPIO15 connected via 10K pulldown resistor to GND and also connected with CSN of nrf24l016, is this connection correct?
Moreover, I am using USB to TTL adapter in place of FTDI and TX of ESP-8266 is connected with RX of TTL serial adapter and vice versa, GND of TTL serial adapter is also connected common GND. It's all the difference from your mentioned procedure.
-
RE: ESP8266 WiFi gateway port for MySensors
Hi Friends
I am having an issue with my NRF24L01+. If I change gw.begin() to anything like below,
gw.begin(incomingMessage, 0, true, 0);
I get an error "radio init fail"
And I am now trying ESP-8266 12E module along with nrf24L01+ (genuine) transceiver to built wifi gateway, which I'll later use as gateway for openhab. I am having a similar issue, Here is the log I get through serial monitor.
**Connecting to Ahmed
...........Connected!
IP: 192.168.0.31
0;0;3;0;9;radio init failctx: cont
sp: 3ffebdf0 end: 3ffec010 offset: 01b0stack>>>
3ffebfa0: 0000007f 3ffec03c 40201cac 3ffeaff0
3ffebfb0: 40202320 00000001 00000000 40201d4f
3ffebfc0: 1f00a8c0 00ffffff 0100a8c0 3ffec03c
3ffebfd0: 3ffe9328 3ffead34 3ffec070 402026ef
3ffebfe0: 3ffe98a8 1f00a8c0 00000000 00000000
3ffebff0: 3fffdc20 00000000 3ffec034 40201d1f
3ffec000: 00000000 00000000 3ffeaff0 40100398
<<<stack<<<ets Jan 8 2013,rst cause:1, boot mode:(3,3)
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld**This information runs in a loop again and again. I am using latest library from https://github.com/mysensors/Arduino/tree/master without editing the sample Esp8266Gateway sktech except user name and password. I have followed the connection instruction specified in sample sketch and sketch was successfully uploaded. I am using 101nf capacitors and 10K resistances as specified by https://www.youtube.com/watch?v=JA-0hs5rpMY.
Everything is working fine except that error. May anyone help me out?