Sonoff-HomeAssistant (Alternative firmware for Sonoff Switches for use with mqtt/HA)

The GPIO for the button is 0. If you have a look at the firmware it’s defined in there :smiley:

Hi @KmanOz could you be please so kind and try to make FW for IM160601001 (itead motor switch) I can buy one for you if you want :wink:

What type of functionality do you require from the unit exactly.

All

Received some products today from Sonoff. I started playing with the LED strips. They are not RGB. They have 1 strip of COOL white LEDs and 1 stip of WARM while LEDS. The software that Sonoff supply allow you to set 3 colours, WARM, COOL and a mixture of both. It seems they’ve been designed to replace an overhead fluorescent tube.

Are people interested in these? Personally I would have preferred RGB LEDS. From the specs on their website it seems that they have reserved some IO pins to allow RGB. I am trying to source a schematic of what they’ve built to see if it can be adapted to RGB because even the circuit board silkscreen suggest that it may.

I will try and work with Sonoff to make these work because could be a good cheap controller for LED strips.

Will keep you all updated with my progress.

Kman

2 Likes

Yes, I’m also waiting my LED to arrive. I plan to put one of them on my kitchen under a cabinet, and the other one on my bedroom, over the bed.
I just need the standard cool-warm colours, so I’ll keep on eye on your updates.

Cool

Mine didn’t work using their EWeLink app. They paired OK but do not turn on of off. I thought I would give their app a go before I started tinkering with them. I have a ticket open with iTead and am waiting for their response. Possibly a faulty unit but time will tell. Yep will keep you posted,

Edit: I didn’t receive a necessary shunt plug that needs to be inserted at the end of the the chain of LED strips.

Is there anyone that can help to write a mqtt light component for HA specifically for the iTead LED. Basically we need to emulate the remote control namely EWeLink. We need a nice front end for HA for it to to be a complete solution I feel. It should be easy and we can work together on a protocol (JSON) between HA and the LED controller. If anyone is capable either post a message here or send me a message.

Thanks

Why not use the MQTT light component from HA? Maybe with that and a input_select for light temperature selection…
EDIT: Sorry, just re-read and understood that you first want to play with the non-manipulated sonoff. I don’t know much about programming, but tell if I can help in anything (testing i.e.)

We need to control 3 parameters. Colour (3 options) so a three position switch, brightness (so a slider) and power ON/OFF. I just feel a separate component would make it very easy for anyone to setup. Basically add component. add mqtt topic and everything comes up.

EDIT: I just saw MQTT Light component. I will play with it tomorrow and see. Yes it might be possible with just that.

For the colour temp the color_temp_command_topic can be used.

Did you finally tested the mqtt light component? Just received my LEDs, will try one this weekend with their app, but honestly, I would like HA integration if posible :wink:

No I didn’t have a chance. I will over the weekend.

Thanks KmanOz for your work on the Sonoff range and greetings from a fellow Aussie.

I have used your Git Hub code for the TH16 and it is working fine.
Takes a little time to connect but once connected is very solid in Home Assistant.
The switch works consistently and the temp and humidity values report to the HA dashboard.

Initially, I used the Itead app to “get into the game” of home automation and got used to the timers.
Do you have any suggestions for a beginner like myself how setting timers might be possible?

Thanks again and it is just great to see how you have assisted us all to use these inexpensive Itead products in Home Assistant,

Cheers
RAWB

No worries at all. Taking long to connect can be a a number of factors from your wireless router to signal strength etc. If you notice in the code there is a line that says:

int kRetries = 10;

If you find it’s not connecting quickly and it times out a lot (flashes 4 times over and over) before it connects, you can increase that retry value to say 20 or 30. The code sits in the connect loop longer if you do that rather than timing out early.

As for timers, now that you have it running with HA, you can do anything.

Check this HASS sprinkler

Good luck.

@KmanOz used your code on a sonoff switch and it worked first time. I am using the switch to control aquarium lighting and would like to implement a time schedule. The sprinkler example looks good but complex for my requirements. Just need to switch on and off for a period every day. I tend to like clean and simple solutions (that’s why I used your code :).

Tried looking around for some samples but wasn’t successful. Any tips about where I can find some sample code please?

LOL you probably need to start to get to know HomeAssistant. Here’s 2 simple automations. First one turns on the switch, second one turns it off.

- alias: Turn on Fishtank Lights at 9:00pm
  trigger:
    platform: time
    after: '21:00:00'
  action:
    service: switch.turn_on
    entity_id: switch.fishtank_lights

- alias: Turn off Fishtank Lights at 10:30pm
  trigger:
    platform: time
    after: '22:30:00'
  action:
    service: switch.turn_off
    entity_id: switch.fishtank_lights

That’s about as simple as it gets.

Is it possible to flash this without an arduino? I have a usb to serial and am trying to use easyesp but would rather use this if possible

You don’t actually need an Arduino board at all. You only need the Arduino IDE (Software) installed on your computer and an FTDI adapter. Hope that helps.

1 Like

Edit: found my issues.

Should the blue light be on all the time?

Also I have a different temp probe (DS18B20) Looks like it uses the one wire protocol not DHT :frowning:

Hi

Yes the blue light should be on all the time. It tells you that it’s connected to an Access Point and mqtt. Sorry no support for the DS18B20 and I haven’t actually got one here to try it. It wouldn’t take me very long at all if there was demand for it but it seems most use the DHT-22 because it also reports Humidity.