-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sonoff switch #6
Comments
Or do you think it will just work? I'm getting one to test in the next couple of weeks. |
It works fine on a sonoff. I just used the arduino ide software to program it - I used the nodemcu.9v on the arduino type - I use them with the alexa echo dot Great pieces of software... Joe |
I received 4 today and had a quick go. Using arduino I had it on generic esp8266 board and 1m flash. I changed the relay pin to pin 12 in the code and was getting error esp com mem failed or something like that. Was the pin number all you changed? And do I have to change the board type to nodemcu 9v and that will be me sorted? Really excited about this. An Alexa switch for £5! :-) |
I used a fdti 3.3v |
I also use a ftdi 3.3v as the programmer. Change the ssid Pins Joe On Mon, Nov 14, 2016 at 6:12 PM, shenery notifications@github.com wrote:
|
The esp mem code error -likely means your device is not in flash mode TO flash: Press and hold the button, do not release: while holding it down, plug in Joe On Mon, Nov 14, 2016 at 6:49 PM, joe basque joeman2116@gmail.com wrote:
|
Ok thanks for the advice. I will give it a try today. Cheers |
I tried nodemcu 0.9 esp-12. 1m spiffs and I'm still getting error mem esp com failed. Also d6 doesn't work for me. Isn't the relay gpio 12? It doesn't even compile when I have it as d6 but when I change to 12 it compiles fine. |
D6 not d6 - my mistake gpio12 is D6 Ok, mem esp error - well that is a serial comm problem which means unit is I leave the nodemcu .9 at 3m spiffs but 1meg is fine... The error your It is a communication issue related to wiring and or not in correct mode to Joe On Tue, Nov 15, 2016 at 3:46 AM, shenery notifications@github.com wrote:
|
Ok so I've been spending a bit more time on this. I have all your settings loaded. I have a fT232RL ftdi like this on http://m.ebay.co.uk/itm/Latest-Version-FT232BL-FTDI-USB-to-TTL-Serial-Adapter-for-Arduino-UK-Seller-/181797979805?nav=SEARCH connected to the sonoff. All wires connected and have been checked numerous times. I have it plugged into my tablet via USB otg and I have also tried through a powered USB hub and I am still getting the espcomm mem failed error. I occasionally get a java lang nullpointerexception error as well. Do you think it could be a power supply issue? Kind regards |
Also I press the button on the sonos and keep holding it until I plug it in to the tablet and there is no blinking led. I assume that's me in flash mode? |
It still appears your system is not in flash mode.
Joe On Thu, Nov 17, 2016, 1:52 PM shenery notifications@github.com wrote:
|
The powersupply will not usually be a problem when doing a flash For your programmer, tx am rx are the typical error area. If all fails Joe On Thu, Nov 17, 2016, 2:20 PM joe basque joeman2116@gmail.com wrote:
|
I've tried all of that. Jumper is on the 3.3v. Vcc is the 3.3v. Checked in device manager which com port is recognised when I connect. Serial monitor window not opened. I saw on this forum that some people were getting the same error and fixed it with clearing the flash with esptool before flashing the new firmware? Do you have any experience with this? I can't see esptool in the programmer of arduino ide. |
Sorry forgot to post the forum. http://tech.scargill.net/itead-slampher-and-sonoff/ |
Well all sounds good Sometimes an esp wont work so i use the esptool to refresh it. Wish you had another regular esp nodemcu to see if you could flash it. On Fri, Nov 18, 2016, 3:06 PM shenery notifications@github.com wrote:
|
ok so I got a bit further today. I got this. when I bring up serial monitor it says f5, fo, f5 f0 and there is no indication that the esp is connected to my network. when scan my network there is no esp device |
Was that done with esptool?
Try running it(espool) and writing a blank bin at 0000
Do a google and you should find one
If it writes ok then disconnect and reboot
Then run up the arduino ide program and upload the code for the esp..
Make sure you put it in the flash mode
Joe
If you had teamviewer I could look at the screen etc and maybe help more..
…On Thu, Nov 24, 2016 at 11:48 AM, shenery ***@***.***> wrote:
ok so I got a bit further today. I got this.
83936 bytes from C:\Users\Shenery\AppData\Local\Temp\arduino_build_786479/sinric.ino.bin
to flash at 0x00000000
erasing flash
size: 045520 address: 000000
first_sector_index: 0
total_sector_count: 70
head_sector_count: 16
adjusted_sector_count: 54
erase_size: 036000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting serial port timeouts to 15000 ms
setting serial port timeouts to 1000 ms
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................
[ 28% ]
................................................................................
[ 57% ]
................................................................................
[ 86% ]
...................................... [ 100% ]
starting app without reboot
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
closing bootloader
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
I plugged in a lamp and I get nothing though.
when I bring up serial monitor it says f5, fo, f5 f0 and there is no
indication that the esp is connected to my network. when scan my network
there is no esp device
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWDpY4tPzhzzZX_zkWTX0DQ0qO9yR_acks5rBbHrgaJpZM4KoUCC>
.
|
I set up esptool but not 100% of the command to use to clear the flash. Tried a few but didn't work. I have a blank.bin file saved in the esptool directory. I have installed team viewer and could maybe try that over the weekend if you have time. If you have a command to use in esptool though I could try that? Kind regards |
And when I try the erase flash command in esptool I get esptool error: argument --port/-p: expected one argument |
Ok so I've been having fun getting this going. I found the right command for esptool and have cleared the flash, I was then able to upload the firmware again. I've realised that there is a certain way that you have to wire the lamp in to so that the sonoff is powered via the mains. I scanned devices in alexa and it found my lamp. I asked Alexa to turn on box and she replied ok. But nothing happens the light stays off. I have tested the fuse the bulb and tried in another lamp but it doesn't turn on and I've no idea why. |
Scrap that last post. I forgot to change the gpio pin again and now it works. If anyone's having bother esptool helped out a lot. Basically in my experience you have to use esptool to clear flash before you upload this code. Thank you joeman for all your help it works perfect no :-) |
Great, glad you kept at it.
Joe
…On Sat, Nov 26, 2016, 4:56 PM shenery ***@***.***> wrote:
Scrap that last post. I forgot to change the gpio pin again and now it
works. If anyone's having bother esptool helped out a lot. Basically in my
experience you have to use esptool to clear flash before you upload this
code. Thank you joeman for all your help it works perfect no :-)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWDpY56t4H7nG3racqthCY7o38VWL_Awks5rCJ0KgaJpZM4KoUCC>
.
|
Yeah it works really good. Kind |
You can use a push button. when HIGH call turnOnRelay(); |
I'm not very good with adding code so not sure where to put it in the script. Where would it go? And would I be able to use the program button on gpio 0 for this? If not would the switch go at the mains side or the lamp side? Kind regards |
The esp com failure means it is not likely in flash mode
Make sure u hold down the button an dont let go until a few seconds after
you plug in the programmer.
Joe
…On Tue, Nov 29, 2016, 10:07 AM shenery ***@***.***> wrote:
I'm not very good with adding code so not sure where to put it in the
script. Where would it go? And would I be able to use the program button on
gpio 0 for this? If not would the switch go at the mains side or the lamp
side?
Kind regards
Steven
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWDpY32vGQx2WISNdNjUB9zzmQheLvzzks5rDDFtgaJpZM4KoUCC>
.
|
I have found this piece of code from sonoff boilerplate firmware. Looks like the code to use the button on gpio 0 to switch the relay. } https://github.com/tzapu/SonoffBoilerplate/blob/master/SonoffBoilerplate.ino |
I tried out this code last night. It works fine for tactile switches. I tried it with one of those cheapo switches with a spring. It worked but there was a lot of rapid turn on / off because there is no debounce in the code. |
Hello, I need the compiled bin file of sinric.ino. Can please someone send it to my mail? burhant@gmail.com |
I'm not familiar with OpenHab, though suspect it'll need to communicate with it via some version of MQTT. Check out posts by Peter Scargill at http://tech.scargill.net/ and Tinkerman http://tinkerman.cat/ Hope this helps |
@TCRAKN Hey thanks for getting back. Yeah I've seen those sites before. Would there be a way to incorporate MQTT into this code as well? |
I wouldn't know where to begin with MQTT. I have seen a number of repositories related to Sonoff and MQTT, but can't recall which ones. I now need to find a way to control WS2812 LEDs with an ESP, and maybe with a Sonoff too. There are plenty of accessible I/O pins to do so. Any ideas anyone? Oh, with Alexa commands too... Ciao for now. |
I've done some trawling, and these may be of use to you: https://github.com/arendst/Sonoff-MQTT-OTA-Arduino |
@shenery |
Xose has an Arduino Wiki here that looks quite clear: You can choose which "modules" you want to include in your build, compile and upload. By the way, Itead Studio have hinted that they're going to release a firmware update for the Sonoff that'll include Amazon Echo control. What that entails is anyone's guess! Best |
@TCRAKN, can you post a link to the Sonoff version? Your link has expired. |
Sonoff_WeMo_Alexa_Single-Github.ino.zip Abdul-Khaliq |
@TCRAKN Thanks for uploading this....great piece of work and functions well. I had to move one of the functions before it would compile...might be an issue with 1.6.6 of the IDE and will upgrade to test. I've mounted my Sonoff into an external/waterproof housing and have it controlling pool lights. I see you have enabled the relay to be enabled using the push button. Can this be wired up to an external momentary switch to allow the relay to be triggered? Would like to mount this on my case. F |
@TCRAKN also, forgot to say. I tested this with the official WeMo app and it doesn't detect this device. I wasn't expecting it to, but thought I'd verify. Any chance this could be implemented? |
@farsonic I'm not familiar with the WeMo protocols, but it shouldn't be too difficult to implement by someone that knows how to. I've updated the sketch (below) to correctly illuminate the LED. I'd assumed that a HIGH would illuminate it! Not so. And also, to switch on the relay before attempting WiFi connectivity, rather than after, which caused the switch-on to be somewhat delayed after applying power to the Sonoff. Sonoff_WeMo_Alexa_Single-Github.ino.zip Best |
Thanks, I'll look to get some time this week to look into programming an alternate switch for the relay. Shouldn't be to difficult. I'll do some snooping on the WeMo protocols. Already with your code running it is simple to trigger on/off from the command line using something like this curl --data "request:"1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">1</u:SetBinaryState></s:Body></s:Envelope>" http://192.168.0.173/upnp/control/basicevent1 |
I have to make it clear that I've only added the rudimentary switch and LED functionality to Aruna's original code in this repo. Kudos is his! @kakopappa Abdul-Khaliq |
I've modified the code enough now that it can be discovered by the third party WeMo app called QuickConnect. Seems Quickconnect uses port 49152 which is the standard Wemo port number for its web server. However Alexa will only communicate to it on port 80? Is there a way to have the ESP8266WebServer listening on two ports? F |
farsonic,
The ability to use a third party wemo app and alexa would be a great new
feature.
I run several esp modules and linkr4 modules which work great on the
original code.
I am sure many others would be very much interested in trying your modified
code.
Thanks
Joe
…On Wed, Feb 1, 2017 at 12:06 AM, farsonic ***@***.***> wrote:
I've modified the code enough now that it can be discovered by the third
party WeMo app called QuickConnect. Seems Quickconnect uses port 49152
which is the standard Wemo port number for its web server. However Alexa
will only communicate to it on port 80?
Is there a way to have the ESP8266WebServer listening on two ports?
F
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWDpY-GAlK3BarG6djrthPQ26rxf0tZZks5rYAS0gaJpZM4KoUCC>
.
|
farsonic, its easy enough to run multiple web servers, I have mine with three, one for manual toggling of GPIO and two for Alexa to turn on two different GPIO connected devices. //define the webserver ports const unsigned int portMulti = 1900; //define the webservers ESP8266WebServer webserver(80); //Manual web page //In loop enable service webserver.handleClient(); //Webserver on port 80 // Then for every instance of the following: server. you need to replicate the contents of original one and I simply add a number to the end for each new webserver (find and replace is your friend here!) e.g. server2. I've been playing with the "Wemo Widgets" app to try and add control for the devices on another webserver listening on 49153 but no joy. What have you had to edit to get the app to work with XML/SOAP? |
I have this working with a third party app now to toggle on/off. There is
an issue in the logic to know the state of the relay....I'll attempt to
resolve this ASAP.
FP
…On Thu, Feb 2, 2017 at 4:12 AM, 1rvy ***@***.***> wrote:
farsonic, its easy enough to run multiple web servers, I have mine with
three, one for manual toggling of GPIO and two for Alexa to turn on two
different GPIO connected devices.
//define the webserver ports
const unsigned int portMulti = 1900;
const unsigned int webserverPort = 9876;
const unsigned int webserverPort2 = 9877;
const unsigned int webserverPort3 = 49153;
//define the webservers
ESP8266WebServer webserver(80); //Manual web page
ESP8266WebServer server(webserverPort); //Alexa GPIO4
ESP8266WebServer server2(webserverPort2); //Alexa GPIO5
ESP8266WebServer server3(webserverPort3); //testing with app
//In loop enable service
webserver.handleClient(); //Webserver on port 80
server.handleClient(); //Webserver for Alexa Discovery of Study Lamp
server2.handleClient(); //Webserver for Alexa Discovery of Study LED
server3.handleClient(); //Webserver for Wemo App Discovery
// Then for every instance of the following:
server.
HandleNotFound.
handleUpnpControl.
handleSetupXml.
handleRoot.
responseToSearchUdp.
you need to replicate the contents of original one and I simply add a
number to the end for each new webserver (find and replace is your friend
here!)
e.g.
server2.
HandleNotFound2.
handleUpnpControl2.
handleSetupXml2.
handleRoot2.
responseToSearchUdp2.
I've been playing with the "Wemo Widgets" app to try and add control for
the devices on another webserver listening on 49153 but no joy. What have
you had to edit to get the app to work with XML/SOAP?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFSh0I-PQs_gUE4ZBiGW65PBPnFs9iy5ks5rYMsEgaJpZM4KoUCC>
.
|
@farsonic It works with Alexis as well? When you get it finish, would you be willing to share it? My wife is wanting me to get rid of Alexia because she is so soft spoken and it doesn't work well with her, so I told her I would reprogram all the relays with the ability of an app on her phone once one comes out. This will save my project! Thank you! |
Currently it works with QuickConnect (Third party app) and not Alexa. I
think I can be made to work with both though.
…On Thu, Feb 2, 2017 at 10:49 AM, MacGyver1rjq104 ***@***.***> wrote:
@farsonic <https://github.com/farsonic> It works with Alexis as well?
When you get it finish, would you be willing to share it? My wife is
wanting me to get rid of Alexia because she is so soft spoken and it
doesn't work well with her, so I told her I would reprogram all the relays
with the ability of an app on her phone once one comes out. This will save
my project! Thank you!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFSh0IwivsGulevdnDCpbqAraaEoj8Bkks5rYSgzgaJpZM4KoUCC>
.
|
@farsonic I can't find Quick Connect. Is it the samsung app? |
Sorry my bad, Quickswitch :)
…On Thu, Feb 2, 2017 at 11:51 AM, MacGyver1rjq104 ***@***.***> wrote:
@farsonic <https://github.com/farsonic> I can't find Quick Connect. Is it
the samsung app?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFSh0AYiL3AGS4qu6YfpNvbkVnnz3LfDks5rYTaPgaJpZM4KoUCC>
.
|
I've uploaded the code here. It might be broken as the last thing I was
doing is playing around with detecting/knowing the state of the relay.
https://github.com/farsonic/Sonoff-Wemo
F
…On Thu, Feb 2, 2017 at 12:00 PM, Francois Prowse ***@***.***> wrote:
Sorry my bad, Quickswitch :)
On Thu, Feb 2, 2017 at 11:51 AM, MacGyver1rjq104 ***@***.***
> wrote:
> @farsonic <https://github.com/farsonic> I can't find Quick Connect. Is
> it the samsung app?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#6 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFSh0AYiL3AGS4qu6YfpNvbkVnnz3LfDks5rYTaPgaJpZM4KoUCC>
> .
>
|
Any progress? I have struggle to find solutions. Is there a way to download Wemo's firmware and mod it to work with Sonoff? I believe it works with both the app and Alexa |
Will be looking into this over the weekend and can hopefully make some
progress.
…On Sat, Feb 4, 2017 at 3:37 PM, MacGyver1rjq104 ***@***.***> wrote:
Any progress? I have struggle to find solutions. Is there a way to
download Wemo's firmware and mod it to work with Sonoff? I believe it works
with both the app and Alexa
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFSh0LYF6o48TNK0orqzlN8J4HdVLsQBks5rZA6agaJpZM4KoUCC>
.
|
i had a thought, can this be flashed onto the esp 8285 ? |
Hi @TCRAKN, I can't get the nodemcu to connect to my wifi with your edited code, tried increasing the time but still fails. Any pointers? With best regards |
Hi,
It's not my code and I somehow forked it? Sorry, I'm a newbie. I have got
this working on Wemos D1 and also on Itead sockets too. I found the code
compiled but did not work as I did not have an included library. All
working ok now though. Good luck.
…On 23 February 2017 at 14:32, Svengali86 ***@***.***> wrote:
Hi @TCRAKN <https://github.com/TCRAKN>,
I can't get the nodemcu to connect to my wifi with your edited code, tried
increasing the time but still fails.
Any pointers?
With best regards
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYoIrH-nwu1RBCTDZ188LmnHbvXGmhkvks5rfZiRgaJpZM4KoUCC>
.
|
Hi, sorry, my comment wasn't directed at you. I've got it to work now, by copying the additional switch elements into the original code that worked. Interestingly my device did not like being discovered with my circuit connected. |
Hi team, sorry if I ask in the wrong place. Does anyone know where to find a code for the sonoff dual with interlocking method and to work with echo dot? I need for controll electrical shutters. |
I think I found the error that generated the restart on ESP12. |
Do you think this code could modified to work with the sonoff switch. http://blog.squix.org/2016/01/esp8266-products-hitting-market.html
It has 1M of flash and uses esp8266
The text was updated successfully, but these errors were encountered: