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

Feature request: adding Obi Socket #1988

Closed
Frickelmaster1 opened this Issue Feb 21, 2018 · 57 comments

Comments

Projects
None yet
@Frickelmaster1
Copy link

Frickelmaster1 commented Feb 21, 2018

German DIY store "OBI" is selling ESP8266-based sockets (very similar to Sonoff S20) for less than 10 EUR.

I got two of these sockets. It's quite easy to flash Tasmota on it but it was neccesary to modify sonoff/sonoff_template.h to make it work correctly. The same reason as with other clones: they assigned the GPIOs randomly to the available functions and chose others than ITEAD with their Sonoffs.

It would be nice if this configuration snippet could be added to the official sonoff_template.h.

I suggest adding these lines to sonoff_template.h for making the Obi Socket work:

{ "Obi Socket", // Obi socket (ESP8266) - https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
0, // GPIO00 Flash jumper - not available
0, // GPIO01
0, // GPIO02
0, // GPIO03
GPIO_LED1, // GPIO04 LED on top and in switch button
GPIO_REL1, // GPIO05 Relay 1 (0 = Off, 1 = On)
0, 0, 0, 0, 0, 0, // Flash connection
0, // GPIO12
0, // GPIO13
GPIO_KEY1, // GPIO14 switch button
0,
0, // GPIO16
0 //
},

@reloxx13

This comment has been minimized.

Copy link
Contributor

reloxx13 commented Feb 21, 2018

could you add images from the pins with description which pin is what?

@Frickelmaster1

This comment has been minimized.

Copy link

Frickelmaster1 commented Feb 21, 2018

The descriptions of the pins are printed on the PCB. They are similar to the pin names on any FTDI adapter.

@reloxx13

This comment has been minimized.

Copy link
Contributor

reloxx13 commented Feb 21, 2018

you could try to use the generic module (ex. wemos d1 pre 5.11.0 i think) on the web interface and set up your gpio config.

grafik
(note: this is not from obi)

@martin-ger

This comment has been minimized.

Copy link

martin-ger commented Feb 21, 2018

Some pics from the opened device can be found here: https://github.com/martin-ger/ESP8266-WiFi-Socket

@martin-ger

This comment has been minimized.

Copy link

martin-ger commented Feb 21, 2018

It works somewhat different than the Sonoff basic: a low pulse on GPIO12 switches the relay on, a low pulse on GPIO5 switches it off.

@Frickelmaster1

This comment has been minimized.

Copy link

Frickelmaster1 commented Feb 21, 2018

In my Tasmota there is no "Generic" type so I had to edit the templates...

@tobox

This comment has been minimized.

Copy link

tobox commented Feb 21, 2018

"Generic" has been added during the last days, replacing Wemos D1 Mini and NodeMCU variants.

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented Feb 21, 2018

@Frickelmaster1
Does it work with your setup?
I ask this because martin-ger describes the on off function different

@Frickelmaster1

This comment has been minimized.

Copy link

Frickelmaster1 commented Feb 22, 2018

My first Obi socket works fine, the second doesn't. I flashed the binary with ESPloader to the sockets. The first is OK, the second (with exactly the same firmware) is accessible via web interface, the on-off works (including the blue LED) but the relay isn't switching at all.

Maybe Martin can explain how he modified Tasmota to make it work with the Obi sockets?!

@martin-ger

This comment has been minimized.

Copy link

martin-ger commented Feb 22, 2018

I did not use Tasmota but my onw software - works fine. I am not into the Tasmota code and platform.io, but use the esp_open_sdk and my MQTT framework.

The control of the relay works as follows:

  • a low pulse (150 ms works) on GPIO12 switches the relay on
  • a low pulse on GPIO5 switches it off

The two ports are even named "RELAY ON" and "RELAY OFF" on the PCB of the ESP.

Also have an Arduino sketch that controls the device:
https://github.com/martin-ger/ESP8266-WiFi-Socket/blob/master/OBISocket.ino

@martin-ger

This comment has been minimized.

Copy link

martin-ger commented Feb 22, 2018

In the sources I read something about "latch" - should be similar to this issue #58.

@Frickelmaster1

This comment has been minimized.

Copy link

Frickelmaster1 commented Feb 22, 2018

Although I can't imagine maybe there are differences between my sockets I'll compare them tonight.

Strange... one is working fine, the other one doesn't switch the relay - with identical firmware.

I'll try to use a modified EXS relay configuration on the second socket. Thanks, Martin!

@thxthx0

This comment has been minimized.

Copy link

thxthx0 commented Feb 22, 2018

I have solved the 'pulse issue' by setting GPIO12 to always 0 (as LED) and works fine.

obi wlan kenobi

@Gulaschcowboy

This comment has been minimized.

Copy link

Gulaschcowboy commented Feb 22, 2018

Got mine today and can confirm @thxthx0 solution. Thanx

@hudecitydave

This comment has been minimized.

Copy link

hudecitydave commented Feb 22, 2018

Same here. Confirm @thxthx0. Firmware flash with GND/GPIO0 pin method, update to tasmota 5.12, shown config above. works. THANKS! What a great community!

@Frickelmaster1

This comment has been minimized.

Copy link

Frickelmaster1 commented Feb 23, 2018

Tried it yesterday in the evening - works fine with Tasmota 5.12.x and "Generic" device with the settings above.

Thanks! So my request to add "Obi socket" to Tasmota's sonoff_template.h is no longer necessary :-) Nice!

@reloxx13

This comment has been minimized.

Copy link
Contributor

reloxx13 commented Feb 23, 2018

@etamtlosz

This comment has been minimized.

Copy link

etamtlosz commented Feb 23, 2018

How did you manage to access Tasmota on the OBI plug? I'm struggling since yesterday evening. I'm able to flash it, but no wifi, no interface, nothing.

@reloxx13

This comment has been minimized.

Copy link
Contributor

reloxx13 commented Feb 23, 2018

build the firmware yourself, enter wifi credentials in the user_config.h and flash again.

dont forget to reset the cfg_holder

enter wifi data
change cfg_holder
flash
change cfg_holder back to default
flash again.

their is not btn on gpio1 thats why you cannot start the manager with btn press and default is wps mode

@etamtlosz

This comment has been minimized.

Copy link

etamtlosz commented Feb 23, 2018

I'm doing something wrong.

edited my wireless settings, including ip
changed cfg_holder to the actual day
flashed
reconnected
changed the cfg_holder to 0x20161209
flashed

It won't connect to my wireless, no ping, etc.
I think I'll wait until some more detailed tutorials are going to be published for this plug.

@reloxx13

This comment has been minimized.

Copy link
Contributor

reloxx13 commented Feb 23, 2018

their is nothing more to add, its an esp like in all other devices.

do you got other devices with tasmota which are connected to your wifi?

ip on 0.0.0.0 for dhcp.

no special chars in wifiname and password.

how you want to send a ping without an ip or connection to your router wtf dude...

even if it says its flashed 100% it can be not flashed due a defect usb flasher or you used wrong device config in arduino/atom. read the flash guides in the wiki.

@etamtlosz

This comment has been minimized.

Copy link

etamtlosz commented Feb 23, 2018

My ip was set to a fix IP, this is why I was monitoring the IP with ping.
I'll try with DHCP, now.

I'm using the correct flashing method, I assume - Generic ESP8266 Module.

@gunnwo

This comment has been minimized.

Copy link

gunnwo commented Feb 26, 2018

I have the latest firmware flashed. As the wlan was preconfigured access was possible. But I'm struggeling with the OBI socket and generic Type. Comparing the screen shot from above with the settings I only get 4 entries in the module configuration: GPIO1/3/4/14. So how do you enable the rest of the fields and enter the settings?

@etamtlosz

This comment has been minimized.

Copy link

etamtlosz commented Feb 26, 2018

Change it to generic, save. It will restart an you'll have the other options as well.

@thxthx0

This comment has been minimized.

Copy link

thxthx0 commented Feb 27, 2018

If someone wants to confgure more sensors:

the onboard ESP8266 Module with 1MB is similar to 'WT8266-S1'

wt8266-s1-pins

@cyablo

This comment has been minimized.

Copy link

cyablo commented Feb 27, 2018

Got mine flashed with tasmota and used the settings suggested by thxthx0, but my relay does not turn on. Only Red & Blue LED's turn on. @Frickelmaster1 : Did you get it working on yours?

EDIT: MY BAD!!! Relay only works on wall power, not on 3.3V from USB TTL

@Steakschen

This comment has been minimized.

Copy link

Steakschen commented Apr 24, 2018

I tryed to flash it with esptool.
Connected gpio0 to grnd
it flashes but then dosent boot up.

after 2-3 trys i got:

00:00:09 APP: starte neu

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

and nothign happend further, i used 5.12

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented Apr 24, 2018

@Steakschen PreBuild Image or self compiled?

@Steakschen

This comment has been minimized.

@Steakschen

This comment has been minimized.

Copy link

Steakschen commented Apr 24, 2018

i flashed 2 times, and booted it 5 minutes, now it works
solved :-) wait 2min+ to boot

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented May 14, 2018

Just my humble opinion.
If a OBI is near you, this is a deal if you want the device fast.
If you not in a hurry i would choose sonoff. The build quality of a sonoff S20 is better and it is cheaper.

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented May 14, 2018

@renne

This comment has been minimized.

Copy link
Contributor

renne commented May 14, 2018

@etamtlosz
Use a Tri-Wing screw-driver instead of @martin-ger's drill. ;-)

@Jason2866
If you can get a CE/VDE-compliant sonoff device in Germany ...

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented May 14, 2018

@renne Do you think the OBI device is really tested to be VDE compliant? (hüstel)
CE this means nothing, every crab has this....

@cremofix

This comment has been minimized.

Copy link

cremofix commented May 23, 2018

hey folks,

I build the binaries with Atom and flashed the OBI Socket with the latest Tasmota.
worked fine
I used the workaround described in ct magazine and by @thxthx0 (GPIO12=LED2 and GPIO5=Relais1)
it works fine. I can access the sockets IP and switch it on/off via browser

But I fail to acces the socket via MQTT

I have mosquitto installed on a raspberry as mqtt-broker
I can connect to mosquitto with mqtt.fx
unfortunately it seems that I do not have any connection between the socket an the mqtt broker
this are my mqtt settings:
bildschirmfoto von 2018-05-23 13-31-07

i have to correct myself. There is a connection . I can subscribe to "#"in mqtt.fx an I get the state of the socket without any problems.
But I can not send any commands.

If i try to publish: /OBI1/cmnd/power on

nothing happens
did I forget something?
any idea?
thanks

@dzett

This comment has been minimized.

Copy link

dzett commented May 23, 2018

Hi there,

as per the described behaviour of the stock firmware, the Obi socket seems to use a latching relay only triggered via a short pulse.

Such a relay cannot be triggered from the "Generic" configuration because even though there is a capability to deal with latching relays introduced with 533855c , this is hardcoded against the module type EXS_RELAY which unfortunately has the Two relay outputs on different GPIOs.

I would prefer to use the relay as intended (hence not giving a constant high output on the "On" side of the relay). Is there any easy way to refactor this to be not bound to the module type but have some other "configuration switch" to indicate that GPIO_REL1 and GPIO_REL2 are actually the two latching "ends" of the relay configured?

@renne

This comment has been minimized.

Copy link
Contributor

renne commented May 24, 2018

@dzett
You're right. Firing one coil constantly not only increases wear of that coil but also makes the switching of the relaiy unreliable and increases switching time which can lead to burned contacts.

@arendst
I suggest to add xx Relay N ON and xx xx Relay N OFF in the GPIO list of device configuration. Before and after firing a coil both GPIOs should be set to low.

@cremofix

This comment has been minimized.

Copy link

cremofix commented May 24, 2018

hey folks,

I do not know what I changed but now everything works fine
I can subscribe and publish via MQTT and the OBI socket does everything correctly.
I agree with dzett and renne. the workaround with GPIO=LED2 and coinstant fire on the coil does not seem to be ideal.
I found out that the socket needs more than 2 Watts when switched on and only 0.6 W in standby
It gets about handwarm. So running the latching relay without constant current should be a big improvement
@arendst : would it be a big job to add a profile for this OBI socket?
probably after the article in the ct magazine there will be a lot of persons buying this gadget.

@arendst

This comment has been minimized.

Copy link
Owner

arendst commented May 24, 2018

Get me one for testing (I cannot order with obi as a non-german alien) and I will see how to get it implemented the correct way (using the pulses).

@cremofix

This comment has been minimized.

Copy link

cremofix commented May 25, 2018

@arendst : if you do not want to buy one, perhaps you just implement the pulse function for gpio12 and gpio5. I can test it here with the sockets and give you the results.

@dzett

This comment has been minimized.

Copy link

dzett commented May 25, 2018

@arendst After playing around with the socket a bit more yesterday (trying to use the existing latching implementation for module EXS_RELAY which I assume is working and remapping the GPIOs), I am not so sure that the Obi socket really has a latching relay, as it would turn off right away when the pulse was over.
Also, I looked for some sort of datasheet for the relay that is used (same type as seen on the pictures in earlier posts) and from what I found it seems to be just a plain standard relay. Does anybody still have the stock firmware on it and actually look at the outputs?

Edit: On the other hand, @martin-ger 's coding obviously uses pulses and his pictures show the same hardware :-)

@cremofix

This comment has been minimized.

Copy link

cremofix commented May 25, 2018

I just opened my socket
and found this relais
SMIH-NingBoSongle.pdf

this is not a latching relais. perhaps they use different models?

@thxthx0

This comment has been minimized.

Copy link

thxthx0 commented May 25, 2018

That's right, it is not a latching relay.

There is a standard 16 amp relay,
but driven by 'some kind of latching' transistor circuit.

I couldn't measure any differences in power consumption
by using stock firmware, Tasmota (GPIO12 always 0) or martin-ger's ino.

The relay is driven at about 140mA and 5.4 V

@dzett

This comment has been minimized.

Copy link

dzett commented May 25, 2018

Hi all,

@thxthx0, thanks for clarification - should have checked my inbox a bit earlier :-)

I just picked up another one at Obi and can confirm that also with stock firmware, across the pins driving the relay coil, there is a constant voltage visible while the output is active. The "Relay On" trace from the ESP8266 board goes into something that looks like a circuit around two transistors (flip flop, eh? good old times). So I guess we don't need any code changes after all. Thanks to all!

@thilokru

This comment has been minimized.

Copy link

thilokru commented Jun 5, 2018

Is it normal that the devices get hot? When turned off, it is warm to the touch, but when on it realy heats up.

@thxthx0

This comment has been minimized.

Copy link

thxthx0 commented Jun 8, 2018

Yes, seems to be normal (and a 'feature' of this relay ;).

Power Consumption of the relay is about 0.75W
(data sheet says 0.72W).

It also works reliable @ 4V and 0.4W,
but temperature isn't much different
(~ 40°C at the solder joints & case opened).

@rudi48

This comment has been minimized.

Copy link

rudi48 commented Jun 17, 2018

Unfortunately the Button1 wired to GPIO14 no longer allows to use the Button usage (usually wired to GPIO0), described on https://github.com/arendst/Sonoff-Tasmota/wiki/Button-Usage

Does anybody know how to regain this Button-Usage, e.g. for providing an Access Point with IP address 192.168.4.1?

Correction: Button1 works also with GPIO14, I had a problem with the test.

@renne

This comment has been minimized.

Copy link
Contributor

renne commented Jun 17, 2018

@arendst
I suggest a profile for the Obi WLAN "KenObi" which usses GPIO14 for "Button usage".

@stale

This comment has been minimized.

Copy link

stale bot commented Aug 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 1, 2018

@josch

This comment has been minimized.

Copy link

josch commented Aug 5, 2018

Are the tasmota developers against adding a template for the OBI socket and would prefer that one uses the Generic setting?

Or would a pull request be appreciated?

@stale stale bot removed the stale label Aug 5, 2018

@nobirdnobird

This comment has been minimized.

Copy link

nobirdnobird commented Aug 13, 2018

Yes, I will also really appreciate to add the adapter configuration to the template !
thanks & BR

@ascillato2

This comment has been minimized.

Copy link
Collaborator

ascillato2 commented Sep 4, 2018

@josch

Please, Make a PR.

Thanks

@ascillato2 ascillato2 closed this Sep 4, 2018

@florianschroen

This comment has been minimized.

Copy link
Contributor

florianschroen commented Sep 30, 2018

Created PR #3944

@Jason2866

This comment has been minimized.

Copy link
Contributor

Jason2866 commented Sep 30, 2018

@renne OBI plug is a cheap china device too...
#1988 (comment)
See: #3944
Model tested: WFG-1
Models maybe working: WFF-1, WFE-1, WFI-1, WFD-1, WFR-1, WFA-1, WFU-1
Manufactured by: Cixi Yidong Electronics Co. Ltd - http://www.cn-yidong.com/
Sold by: OBI DIY market in Germany - https://www.obi.de

arendst added a commit that referenced this issue Oct 1, 2018

Add OBI/Teckin Socket support
 * Add support for OBI Power Socket (#1988, #3944)
 * Add support for Teckin Power Socket with Energy Monitoring (#3950)
@dreamlayers

This comment has been minimized.

Copy link

dreamlayers commented Nov 29, 2018

OBI Socket setting also works for Orvibo S25US https://fccid.io/2ACLPS25US/Internal-Photos/Internal-Photos-2970651

Button, relay and blue LED work. The S25US LED can also be red if the blue is turned off and GPIO12 is on. Though red and blue cannot be on at the same time. I experimented with this using Sonoff 4CH module setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment