Welcome to the Athom Community Forum! This is a place to share ideas, ask for help and discuss about Homey in general.

Please read Welcome to the forum to get started.

Sonoff / Ewelink switches

Hi guys,

Received my Homey yesterday and loving it! Everything (Hue, Netatmo thermostat, Sonos, Remotec zwave master, 433 switches, 433 thermometers,...) connected in like 10 minutes <span>:smiley:</span>

But I have 3 Sonoff switches installed and would like to integrate them as well. Is this possible? Did a search on the forum and found something about using webhooks? But was not very clear...

Thanks guys!
«13

Comments

  • RemcoHanninkRemcoHannink Backer - Early Bird
    Hello,

    I have some sonoffs. I flashed them with alternative firmware. After the flash you can just control the via http requests. I don't believe the original firmware (control via cloud) is already reverse engineered. https://www.youtube.com/watch?v=fN_QKOWvG1s

    Gr. Remco
  • rtnartna Member
    I have the same solution as @RemcoHannink running with 5 switches over here. Works fine but I have to restart the switches every now and then because the become unreachable,
  • Joske522Joske522 Member
    Ok guys thanks for the comments, they are running perfectly with the current firmware, and not really into that kind of modifying <span>:blush:</span>

    I will wait for an app that can command the Sonoff's. Really great and really cheap switches by the way! <span>:smile:</span>

    Thanks!
  • rtnartna Member
    edited June 27
    The switches use a proprietary protocol with some kind of Chinese cloud solution. I guess a Homey app is not possible with the original software on the switch.

    And soldering the pinheader and flashing the software is 5 minutes work...  B)
  • I also just replaced the firmware on three of my four Sonoffs. Unfortunately, the first one seems bricked now. I can connect, but when I try to flash it, it always fails. :(
    Flashing the other two went without any problem!
  • rtnartna Member
    Amelsfort said:
    I also just replaced the firmware on three of my four Sonoffs. Unfortunately, the first one seems bricked now. I can connect, but when I try to flash it, it always fails. :(
    Flashing the other two went without any problem!
    Did you place the TX and RX wires correctly?
  • Yes, I also tried switching them. I also tried using different baudrates and a different programmer. Unfortunately, nothing worked on that one Sonoff. :(
    I get the same error as mentioned here: https://github.com/esp8266/Arduino/issues/2428, but I can't use the solution mentioned there since those pins aren't available on the Sonoff. Besides that, it should work with just connecting VCC, GND, TX and RX.
  • I'm looking at the homey now and also have a bunch of Sonoff
    I wouldnt mind flashing in principle, but they are wired all over the house (some mega hard to reach) and work fine (and even better, simply with Alexa - just Turn On and no Ask Homey Too)

    Would love to integrate them into a homey setup like the OP wants without changing firmware
  • I have a few sonoff devices in my setup. But I flashed them with this: http://marvinroger.github.io/homie-esp8266/stable/ 
    It uses (local) MQTT, has ota updates, etc. Works very well with the MQTT client app and VirtualDevices. If you need help setting it up let me know!
  • I have a few sonoff devices in my setup. But I flashed them with this: http://marvinroger.github.io/homie-esp8266/stable/ 
    It uses (local) MQTT, has ota updates, etc. Works very well with the MQTT client app and VirtualDevices. If you need help setting it up let me know!
    When you say ota updates, does that mean I can flash the firmware ota?  If i could do that, happy days :)
  • BartWijersBartWijers Member
    edited September 1
    Once you've flashed the homie firmware (nothing to do with homey) you can push new firmware with MQTT. I've added some code so it has a webinterface where you van upload new firmware and control the switch. But im not sure if you can upload the homie firmware OTA with the stock firmware (I never even looked at the stock firmware) 
  • Thanks. I'll def bear it in mind if (when?) I get a Homey :) 
    It's nice to know that something can be done - even if it's not as simple as out of the box working. Like the OP I'm still relcutant to mess with a setup that right now is working as I want it!
  • So my Homey is on its way!

    Does someone have a n00b guide to MQTT? I know how to flash the Sonoff (tho seems there are a lot of firmware's out there so direction on which is best would be good), but reading the Homey App description seems you need a MQTT broker(?) which sounds like another machine running somewhere?? Or am i overcomplicating it?
  • @vaderag

    Also with version 1.5.0 it is also possible to use HTTP. HTTP can be used on its own (without a MQTT broker). The use of a MQTT broker is still possible and has some advantages over the use of HTTP. 

    When using HTTP,  you have to add users that are allowed to send events to the owntracks app. To do this, go to the owntracks settings page and go to the second button (Change users). Add the user name that you want to give access by entering the name in the empty field below the already known users. Press the "+" button to add the user.


    After you have added the user, the user will show up in the user list and it will have a token generated that is used in the phone app to allow receiving of the events:


    You can remove a user by pressing the "-" button. The "#" button can be used to generate a new token when you think the id has been comprimised.

    In the app on your phone, you should select HTTP as connection:





    Then select HOST:



    The URL you have to enter here is as follows:

    https://<cloudid>.homey.athom.com/api/app/nl.scanno.owntracks/events/?token=<tokenid from user>

    where <cloudid> is the Athom Cloud ID of your homey that you can find in Settings/System.
    The tokenid is the id that is generated when you added the user.

    Using the Athom Cloud is the easiest way of getting started with owntracks. If you are more skilled you can also directly connect to your Homey by port forwarding. Keep in mind that homey itself does not support TLS/SSL. If you want to have a secured session, you need to use a proxy.


    For more information see: https://forum.athom.com/discussion/2804/setup-homey-with-mqtt-for-location-detection

  • vaderagvaderag Member
    edited September 11
    mbalik79 said:
    @vaderag

    Also with version 1.5.0 it is also possible to use HTTP. HTTP can be used on its own (without a MQTT broker). The use of a MQTT broker is still possible and has some advantages over the use of HTTP. 

    When using HTTP,  you have to add users that are allowed to send events to the owntracks app. To do this, go to the owntracks settings page and go to the second button (Change users). Add the user name that you want to give access by entering the name in the empty field below the already known users. Press the "+" button to add the user.


    After you have added the user, the user will show up in the user list and it will have a token generated that is used in the phone app to allow receiving of the events:


    You can remove a user by pressing the "-" button. The "#" button can be used to generate a new token when you think the id has been comprimised.

    In the app on your phone, you should select HTTP as connection:





    Then select HOST:



    The URL you have to enter here is as follows:

    https://<cloudid>.homey.athom.com/api/app/nl.scanno.owntracks/events/?token=<tokenid from user>

    where <cloudid> is the Athom Cloud ID of your homey that you can find in Settings/System.
    The tokenid is the id that is generated when you added the user.

    Using the Athom Cloud is the easiest way of getting started with owntracks. If you are more skilled you can also directly connect to your Homey by port forwarding. Keep in mind that homey itself does not support TLS/SSL. If you want to have a secured session, you need to use a proxy.


    For more information see: https://forum.athom.com/discussion/2804/setup-homey-with-mqtt-for-location-detection


    Thanks for this - sounds like a good way to at least get started - I'm familiar with port forwarding (and to be fair, if someone can do the above they should be able to port forward ;) ) but I might just start simple!

    I think the one part of the explanation above that is confusing / unknown to me is the first step "When using HTTP,  you have to add users that are allowed to send events to the owntracks app. To do this, go to the owntracks settings page and go to the second button (Change users)." - is the the owntracks app for Homey? Or something on the flashed firmware for the Sonoff?

    I guess I just assumed I would be using the MQTT app on Homey?

    Also, which firmware are you using on the Sonoff?
    Thank you again - i guess much of this will become clearer when my homey arrives and I start playing!!
  • @mbalik79
    Just wanted to follow up on the above - which firmware are you using on Sonoff?
  • RemcoHanninkRemcoHannink Backer - Early Bird
    Someone reverse engineered the original firmware of the SonOffs. There's no longer a need to flash them with alternative firmware. 
    It is already implemented for Domoticz. Should be not to big a problem to port this to Homey: https://blog.ipsumdomus.com/sonoff-switch-complete-hack-without-firmware-upgrade-1b2d6632c01

    http://www.domoticz.com/forum/viewtopic.php?f=4&t=18470
  • Someone reverse engineered the original firmware of the SonOffs. There's no longer a need to flash them with alternative firmware. 
    It is already implemented for Domoticz. Should be not to big a problem to port this to Homey: https://blog.ipsumdomus.com/sonoff-switch-complete-hack-without-firmware-upgrade-1b2d6632c01

    http://www.domoticz.com/forum/viewtopic.php?f=4&t=18470
    OMG - Amazing.
    How do we make this happen for Homey?!
  • I would love this as well
  • Just wanted to give this a little bump in case someone with technical skills that surpass my own wants to help the community get access to cheap devices :)
  • Any update on this? I also have some sonoff devices and they are working great.

    Would be a huge benefit to get These supported by Homey.

  • I added something to github, which got closed and they told me mail. It sounds like it's on their backlog but pretty low down, and they implied that the more people who mail support and express interest then the more likely it will be to get done.

    To quote 
    "will put the devices on our list for future implementation. I cannot promise you when this will happen, but if we get more requests the chances are higher that it will be implemented faster:)"

    So, please email and help push this up the list!
  • @vaderag I'm looking at implementing a driver app for it as we speak (probably much faster than waiting for Athom to implement support themselves, they are swamped with work already from what I understand).
  • @vaderag I'm looking at implementing a driver app for it as we speak (probably much faster than waiting for Athom to implement support themselves, they are swamped with work already from what I understand).
    Oh, amazing! Please keep us posted - these are now the only thing in my setup that I haven't got linked in :)
    Out of interest, will the just be WiFi or will it support the rarer 433mhz ones too? (I don't have 433 ones but interested as I imagine others wondering too.)
  • @vaderag only WiFi for now (because that's all I have  :D)
  • @vaderag only WiFi for now (because that's all I have  :D)
    Absolutely fair enough!

    I'm excited :)
  • Does sonoff report status?

    greetings,
    Aaron
  • Aaron said:
    Does sonoff report status?

    greetings,
    Aaron
    Not sure specifically what you mean, but if I load the app it will tell me status irrespective of how it was changed (e.g. Alexa), so assume so
  •  :) I think you understand what I meant. For example, milight does not report. If I change the light through the milight app, homey does not know the status of the lamp (on/off)

    Aaron
  • Aaron said:
     :) I think you understand what I meant. For example, milight does not report. If I change the light through the milight app, homey does not know the status of the lamp (on/off)

    Aaron
    Thinking about it, the Alexa command goes through the sonoff server so it may not be reporting might just be tracking... I'm pretty certain the status can be obtained tho based on other things I've ready
Sign In or Register to comment.