[BETA] Sonoff Wi-Fi Switch DIY mode

For those who, like me, wants just the ON/OFF functionality of a Sonoff mini r2 AND was not able to install Tasmota in it (what a failure ... shame on me!), this is a basic driver to use the switch capability of this device using Sonoff's DIY mode.

The driver and documentation can be found here:

It is available to install using HPM (Hubitat Package Manager - awsome app!).
Note: Waiting for the incorporation of this package into HPM - in a few days it will be available.

I would prefer using Tasmota, but, believe me, it took me LESS time to develop this driver than the time I spent trying, over and over, to install Tasmota in it - not Tasmota firmware problem I can assure. It is that the device was not helpful at all! So, I gave up and this driver is my last resort to use my Sonoff mini r2 in my home.

I would like to suggest that, anyone who wants to further develop this driver, please contact me using a PM. I'd be glad to incorporate new functionalities developed by others or even relinquish control over it.

Releases:

  • 0.1.0 - 2021-03-16
    Initial commit
3 Likes

Can I ask if there are any plans to update the driver to allow the startup state to be changed. This would mean that whenever the device is turned on it would deliver power without having to connect to wifi and then be turned on.

Hi!

I’m returning from a short trip now and I’ll check it out soon.

I am happily using this driver ever since I 've discovered it; no need to convert to Tasmota ! But, I am quite puzzled by the fact that switching by means of the physical, spdt switch, is not picked-up by the driver. I am not even receiving lan-messages to parse. This should at least be possible given the fact that the Sonoff DIY tool can do this. So I am positive that it can be done.

Now, how would I go about adding this functionality? Please be sure to type slow because I am a bit rusty in the ol' programing department.

Any help as far as pointers in the right direction are very much appreciated!

@acm.konings,

It seems that he Sonoff DIY Tool uses mDNS service to get the device switch changes and, as far as I know, the Hubitat hub doesn't support it - at least not yet. So, without HE support for mDNS will be not possible to implement it.

@maffpt,

Thank you for answering so quickly! That being said, if I manually press 'getInfo' it updates to the correct state. So I thought, that's simply solved by 'runIn' or 'runInMillis'. But that doesn't seem to work either.

void letsGo (){
    
    getInfo()
    
    runInMillis(3000, "letsGo")
}

(The letsGo() function is initially being called from updated(), because i gathered from the logs that it is the first function to be called.) I'm pulling my hair out here - and there's not many left :laughing:. Can anyone help (pretty please)?

@acm.konings,

I'm doing some tests here to find a way to overcome this limitation.

However, with the current tools available by the Sonoff's side, the only way of dealing with it would be inquiring the device periodically and it could potentially overload the HE hub.

One of the things I'm doing is to optimize the code to the max so it could - potentially - cause the minimum overhead possible.

Also, I plan to allow the user to:

  • Configure the frequency of the device pooling
  • Configure a schedule where different pooling frequencies could be established throughout the day

Hope it will help.

1 Like