WAF in jeopardy today

  • So I live in Wisconsin USA in the middle of the state. Between last night and today we have had some really bad weather. This afternoon we had a routine power outage for a quick second and the power came right back on. Since then, literally ~75% of the lighing in my house doesn't work. Most times it is an issue with my Vera controller, so just to be safe, I rebooted that. Still no luck. The majority of my light/ceiling fan combinations are run from Sonoff devices running the ESPEasy firmware. My wall switches that control them are MySensors based. I currently have 12 Sonoff basic devices deployed around my house. After the power outage, all 12 of these are showing as offline. The MySensors scene controllers that run these work like a champ. With that many devices not working, I got "THE LOOK" when I told her that she had to manually operate the lights in the bedroom until I could get things fixed. I would like to replace these Sonoff devices with MySensors based relay controllers. Does anyone have a recommendation of an existing dual relay controller setup that I can mount inside my ceiling fan housing to control the overhead light and ceiling fan assemblies in my rooms? My current MySensors network is primarily based on nRF24L01 radios. If there are no recommendations, I would like to design something.

    Thanks in advance

  • Hardware Contributor

    Hi @dbemowsk, I had connection problems with Sonoff before also (not sure if it was them or wifi router or something else, but after power outage it was somtimes a pain to get them back online) so I was planning to make a plugin board for Sonoff devices.
    As they have power + /RX/TX connector, we could have a relatively basic protocol to receive commands and return info on uart, and plug in a basic mysensors node to make the uart<=>mysensors conversion.
    As there's only little space in the enclosures, the best option is something based on nrf5, either a tiny nrf51 or nrf52 module or a board made from scratch with an nrf52832 chip. I guess a good candidate is nrf51822-04 module as it's both ultra-cheap and tiny.

  • Check out Felix's switchmote series at LowPowerLab:
    I have this switchmote that has been bulletproof. It only has one relay and it is Moteino (RFM69) based.
    He has a 2 relay version of the PSU:
    Even if it is not what you are looking for, it it a nice design to study.

  • Can you connect to Sonoffs web pages?
    Or can you see its SSID if they are in AP mode?
    My Sonoffs Basic is switched off four times per every day and works like charm.
    No DHCP, fixed IP, Domoticz. It is the most stable part of my sensors network.
    It Is not probable, that all of yours are bad.
    It must je different problem.

  • UPDATE: So the Vera plugin that I modified to work with my sonoffs will show the status (online/offline) next to the switch controls on my Vera device list. This is done by the plugin using a ping signal to it's web address.
    All of my Sonoff devices showed offline. When I tried to access the web pages of them, the browser couldn't connect, which was no surprise. One of them controls a tabletop lamp in my living room which I just have the controller spliced into a 2 prong extension cord. I reset that one a couple times and it came to life. Most of the other ones are mounted in the ceiling light/fan housing with no easy way to reset power. I ended up cycling the circuit breakers at the electric panel and was able to get all of them back online.

    The power outage that killed them was a split second power outage. My wife and I were watching a movie on our Roku box and when it happened, the Roku box reset, but the TV did not shut off, which told me that it was just a quick flash. If that's all it takes to flake out a sonoff basic, all the more reason for me to lean towards switching to MySensors controllers for those. In all the times my MySensors switches and other devices have gone through power outages, even the brief ones like the other day, they have not skipped a beat when the power has come back on. Don't get me wrong, I still like the sonoff devices, I am just looking for the kind of reliability that doesn't put the WAF of my automation system into question.

  • One other reason I'd like to switch to a MySensors based solution is that I bought a new batch of 5 Sonoff Basics, only to find that they changed the design of the board. The one on the right in the two images is the old version, and the left is the new updated version.

    The old version was based off of the ESP8266 controller like the NodeMCU devices. The new ones are ESP8285 based. The firmware that I use on my Sonoff devices is the ESPEasy firmware. My Vera plugin, which is a modified version of the "HTTP Switch (WiFi Switch)" plugin. My ESP8266 based sonoff devices were easily programmed using the Arduino IDE selecting ESP8266 with 64M No SPIFFS. Even after selecting ESP8285 and trying multiple SPIFFS settings, I cannot get them to flash. The ESPEasy website claims that the 8285 is supported, but they don't seem to show a way of flashing them that works. I have read a number of forum posts from various places that say they are difficult to program, with no one having a clear cut set of instructions to program them. Another reason to go the MySensors route.

  • @dbemowsk
    I have 12 of these new and working without any problems.
    There is a missing gpio14 pin, where I connected the DS18B20, but I used the RX pin instead.
    PCB design is more solid to me - you can even see the power fuse.
    ESPeasy flashing without problem using esptool.
    My way to program new Sonoffs:

    To check comunication:
    esptool.py --port /dev/ttyUSB0 flash_id

    Erase flash:
    esptool.py --port /dev/ttyUSB0 erase_flash

    Program ESPeasy bin:
    esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin

    Look here:

  • @kimot Do you have a copy of your ESP_Easy bin file? It would be nice to program these and use them, it's just been a big struggle trying to find out how to do it. The earlier ones I got were ESP8266 based and flashed really easy with the arduino IDE. I am assuming you are hooking it up with the standard gnd-gnd, tx-rx, rx-tx and 3.3v-3.3v, correct?

  • @kimot Thanks, I will try flashing them tonight.

  • @kimot So I don't do a lot with python, and when I try to use a command similar to what you posted I get errors. So here is some background on the file structure that I have. I downloaded the ESPEasy_v2.0-20180322.zip file and unpacked it to a folder. That contained a source folder, the .bin files and a set of windows esp flash tools. I noticed that it didn't include the esptool.py python scripts, so I downloaded the source code zip file and unpacked the test folder into the same folder as the .bin files, since that looked like it had the necessary python scripts. So now I have a source and test folder, the .bin files and the windows executables. I navigated a terminal window into the test folder and ran this:

    ./esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ../ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin

    This is the errors that I got when I ran it.

    [dbemowsk@phpwebscripting test]$ ./esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ../ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin
    esptool.py v1.3
    Traceback (most recent call last):
      File "./esptool.py", line 1328, in <module>
      File "./esptool.py", line 1236, in main
        esp = ESPROM(args.port, initial_baud)
      File "./esptool.py", line 75, in __init__
        self._port = serial.serial_for_url(port)
      File "/usr/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
      File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 265, in open
      File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 595, in _update_dtr_state
        fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
    IOError: [Errno 5] Input/output error
    [dbemowsk@phpwebscripting test]$

    I must be missing something, but I cannot figure out what it is.

    EDIT: if it matters, I am running Fedora 28 linux.

  • @dbemowsk

    You must install esptool:

    Attention, there are some dependencies...

    Then normally go to folder where .bin file is placed and run command:

    esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin


    python esptool.py .........................

    not ./esptool.py

    But I suggest first try :

    esptool.py --port /dev/ttyUSB0 flash_id

    To check if every is OK ( port, etc )

  • @kimot I had already tried that through dnf prior to running that, but I did it again.

    [root@phpwebscripting test]# sudo dnf install esptool
    Last metadata expiration check: 2:13:12 ago on Wed 27 Feb 2019 04:35:51 AM CST.
    Package esptool-2.3.1-1.fc27.noarch is already installed, skipping.
    Dependencies resolved.
    Nothing to do.
    [root@phpwebscripting test]# 

  • I know WAF is not a joking matter, but I immediately heard Greg Kihn sing, " my WAf's in jeopardy, baby".

  • @wallyllama YES.....Drop the mic.

  • @kimot So I'm a bit confused. I ran this:

    pip install esptool

    and then got this:

    [root@phpwebscripting test]# esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ../ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin
    esptool.py v2.6
    Serial port /dev/ttyUSB0
    Detecting chip type... ESP8266
    Chip is ESP8285
    Features: WiFi, Embedded Flash
    MAC: dc:4f:22:92:eb:55
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Auto-detected Flash size: 1MB
    Compressed 609280 bytes to 403063...
    Wrote 609280 bytes (403063 compressed) at 0x00000000 in 36.0 seconds (effective 135.4 kbit/s)...
    Hash of data verified.
    Hard resetting via RTS pin...

    So it worked. BUT, I connected a second one and tried running it again and got this:

    [root@phpwebscripting test]# esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 ../ESP_Easy_v2.0-20180322_normal_ESP8285_1024.bin
    esptool.py v2.6
    Serial port /dev/ttyUSB0
    Traceback (most recent call last):
      File "/usr/bin/esptool.py", line 2959, in <module>
      File "/usr/bin/esptool.py", line 2952, in _main
      File "/usr/bin/esptool.py", line 2646, in main
        esp = ESPLoader.detect_chip(each_port, initial_baud, args.before, args.trace)
      File "/usr/bin/esptool.py", line 258, in detect_chip
        detect_port = ESPLoader(port, baud, trace_enabled=trace_enabled)
      File "/usr/bin/esptool.py", line 222, in __init__
        self._port = serial.serial_for_url(port)
      File "/usr/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
      File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 265, in open
      File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 595, in _update_dtr_state
        fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
    IOError: [Errno 5] Input/output error

    I ended up getting them all programmed, but I had to unplug and plug in the serial adapter a few times to reset it. It had even reset the device to /dev/ttyUSB1 for a couple of them. STRANGE...

    Thanks for the help.

  • @dbemowsk
    Yes, sometimes it got USB1 instead of USB0.
    You can create fix symlink for your USBtoSerial adapter and then write for example ttySonoff and allways will be right.

  • @kimot The main thing is that I got them flashed. I still have yet to figure out the new firmware and test them, but I am confident I can get them to work.

    Thanks again.

Log in to reply

Suggested Topics

  • 4
  • 9
  • 9
  • 14
  • 1
  • 2