Cheap Chinese WIFI module

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Cheap Chinese WIFI module

Post by sincze »

krizzz wrote:
sincze wrote:
krizzz wrote:But probably Hornbach only sells units aproved by TUV after testing. I even have a little bit more faith in this...
@Krizzz i did find this http://tinkerman.cat/sonoff-th10-th16-s ... actuators/ :shock: :D
https://www.itead.cc/wiki/images/f/f7/C ... Series.pdf
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
Eddiever
Posts: 105
Joined: Thursday 27 April 2017 20:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: The Netherlands (Hoogeveen)
Contact:

Re: Cheap Chinese WIFI module

Post by Eddiever »

sincze wrote:Just the settings for easy_setup.
Sonoff_Settings_3.JPG
Sonoff_Settings_4.JPG

ESPEasy settings for switching a bulb for example.
And at the bottom the settings for the virtual switch in domoticz.

Code: Select all

On: http://IP_Address_of_Sonoff/control?cmd=GPIO,12,1
Off: http://IP_Address_of_Sonoff/control?cmd=GPIO,12,0
Ow and for the internal LED ;-)

Code: Select all

On: http://IP_Address_of_Sonoff/control?cmd=GPIO,13,0
Off http://IP_Address_of_Sonoff/control?cmd=GPIO,13,1
##UPDATE:

On the ESP Easy Under Tools -> Advanced, I enabled rules. http://www.letscontrolit.com/wiki/index ... rial_Rules
Under rules I entered:

Code: Select all

on lamp_on do
    gpio,12,1
    gpio,13,0
endon

on lamp_off do
    gpio,12,0
    gpio,13,1
endon

on SW_1#Switch do
  if [SW_1#Switch]=1
    gpio,12,1
    gpio,13,0
  else
    gpio,12,0
    gpio,13,1
  endif
endon
In this way If I call from domoticz:

Code: Select all

On: http://IP_Address_of_Sonoff/control?cmd=event,lamp_on
Off: http://IP_Address_of_Sonoff/control?cmd=event,lamp_on
This will switch on / off the lamp AND the LED light inside of the Sonoff box. :D.
In addition pressing the PUSH button on the Sonoff will trigger the light as well and update the domoticz status.
A Slight modification in the device name was needed.
Sonoff_Settings_2.JPG
This one helped me a lot. I am a newbee and not afraid to try things out. But what doesn't work is the status change in Domoticz when I push the pushbutton. Any idea?
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Cheap Chinese WIFI module

Post by sincze »

mmm Strange.. If I push the button on the Sonoff domoticz is updated and the light is switched on.
Really strange indeed.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Vojta
Posts: 3
Joined: Sunday 05 March 2017 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by Vojta »

Hi,
I´m trying to achieve reflecting the status. However not working for me as well.
Rule looks logically and make sense to me.

Could you please review my settings below If I´m doing something wrong

Image
Image
Image

Thank you

That´s the only thing which missing in my implementation across house ;)
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: Cheap Chinese WIFI module

Post by thecosmicgate »

At the moment I am having some send / received = signal problems. Is there someone who moded the antenna to get a bit more / better signal ?

Sent from my SM-G935F using Tapatalk
It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: RE: Re: Cheap Chinese WIFI module

Post by thecosmicgate »

thecosmicgate wrote:At the moment I am having some send / received = signal problems. Is there someone who moded the antenna to get a bit more / better signal ?

Sent from my SM-G935F using Tapatalk
Nobody with the same issue ;(

Sent from my SM-G935F using Tapatalk
It's nice to be important, but it's more important to be nice
Scooter ;)
SweetPants

Re: Cheap Chinese WIFI module

Post by SweetPants »

thecosmicgate wrote:At the moment I am having some send / received = signal problems. Is there someone who moded the antenna to get a bit more / better signal ?
There are different modules with different antenna's. There are also modules (like the ESP07) that allows to connect an external antenna, so all depends on the module type you have.
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: RE: Re: Cheap Chinese WIFI module

Post by thecosmicgate »

SweetPants wrote:
thecosmicgate wrote:At the moment I am having some send / received = signal problems. Is there someone who moded the antenna to get a bit more / better signal ?
There are different modules with different antenna's. There are also modules (like the ESP07) that allows to connect an external antenna, so all depends on the module type you have.
But on the sonoff side there's no difference I think .

Sent from my SM-G935F using Tapatalk
It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
sisaenkov
Posts: 50
Joined: Friday 27 May 2016 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8
Location: Moscow, Russia
Contact:

Re: Cheap Chinese WIFI module

Post by sisaenkov »

My edition of ESP easy settings for Sonoff 1ch relay below.

Works in all directions:
- pushing the button on Sonoff turns On/Off relay with LED and changing Domoticz device state.
- turning On/Off in Domoticz also turns On/Off relay with LED too.


Domoticz

Code: Select all

On: http://esp05/control?cmd=GPIO,12,1
Off: http://esp05/control?cmd=GPIO,12,0
ESP Easy devices
31-05-2017 20-26-04.png
31-05-2017 20-26-04.png (15.99 KiB) Viewed 4726 times
31-05-2017 20-26-15.png
31-05-2017 20-26-15.png (27.22 KiB) Viewed 4726 times
31-05-2017 20-26-27.png
31-05-2017 20-26-27.png (26.66 KiB) Viewed 4726 times
ESP Easy rules

Code: Select all

on btn1#Switch do
  if [btn1#Switch]=1
    gpio,12,1
  else
    gpio,12,0
  endif
endon

on Relay#Switch do
  if [Relay#Switch]=1
    gpio,13,0
  else
    gpio,13,1
  endif
endon
pheerink
Posts: 5
Joined: Monday 07 November 2016 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by pheerink »

Domoticz generates ON/OFF commands randomly. If it starts then it continues to generate log items and switches the relais until I remove the http (ON) command. No rules defined or so. Just simple HTTP command to switch it On and OFF as stated. Sometimes it works fine and then it starts ???? Anyone an idea?
femuruy
Posts: 9
Joined: Sunday 23 July 2017 3:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by femuruy »

Guys all this info has been more than useful, so thank you very much for taking your time to post it ... now a little question
I managed to get 1 module connected to domoticz as per the instructions here but how do i add the RSSI wifi strength to the sensors? i mean how do i read it in domoticz?

Thank you in advance!

Femuruy
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Cheap Chinese WIFI module

Post by Domosapiens »

how do i add the RSSI wifi strength
In Domoticz:
-> Hardware->create dummy
-> create virtual sensor-> custom sensor (axis label dBm)
Note the IDX under ->Devices

In ESPEasy create a new Task
Device: System Info,
Name <your name>
Indicator: Wifi RSSI
Fill-in Domoticz IDX
Delay f.i. 600
Name <your name but different>
Decimals:0
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
femuruy
Posts: 9
Joined: Sunday 23 July 2017 3:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by femuruy »

So if i get this right one physicall device has several IDXs? i.e the sonoff has one assigned for each "function"? one for the Relay, one for the Button, one for the WiFi strength meter?

Sorry in advance if this is a stupid question ... i am just very very very new to Domoticz ...

Thanks!
User avatar
Eddiever
Posts: 105
Joined: Thursday 27 April 2017 20:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: The Netherlands (Hoogeveen)
Contact:

Re: Cheap Chinese WIFI module

Post by Eddiever »

The fysical device has one IDX, the second IDX is for the new dummy switch.
pheerink
Posts: 5
Joined: Monday 07 November 2016 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by pheerink »

I was not able to get it working as described here (see my previous post) . So I installed the ESP_easy V.2.0.0 software and now all is running great. The Sonoff WifI connection is much more stabler than before. No random ON/Off's and the pushbutton is working as well. All is reflected in Domoticz. I'm going to flash the next device to see if that has the same result. I strongly recommend the V2.0 for this device!
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Cheap Chinese WIFI module

Post by philchillbill »

With version 120 of the ESPeasy firmware I had to go to 'tools --> advanced --> enable serial port' and disable the serial port to be able to see all the GPIO options in switch creation (otherwise some were blanked out). Also, under the hardware menu make sure that SDA and SCL are not set to any of GPIO's 0, 12, 13 or those options will be grayed out.

With the Sonoff TH10 and TH16 the push-button on the device is GPIO 0 and not 1. There is more than one type of Sonoff so make sure you are applying the right solution for your version.

On the newest baby Sonoff TH_V1.1 revision (mine is dated 2017-5-5) the push-button is (also) GPIO 0 - was it ever GPIO 1 or was that a typo in earlier posts (I don't have older devices so cannot verify)?

If you program these newer baby devices using the standalone flasher, the Sonoff will appear to flash OK but when you power it up there will be no ESP_0 wifi network. The solution to this is to make sure that the flash mode is 'DOUT' which cannot be set from the standalone flashing program. A solution I used was to deploy the ArduinoIDE where there is an option to select flash-mode. I haven't used it myself, but apparently "esptool.py write_flash -fm dout" will also work.
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
bing69
Posts: 139
Joined: Thursday 05 June 2014 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: 's-Hertogenbosch, NL
Contact:

Re: Cheap Chinese WIFI module

Post by bing69 »

Have one day run a Sonoff (cheapest version). However, if he is not used and I send an HTTP command (http://192.168.1.91/control?cmd=GPIO,12,1) he can not reach the sonoff. It seems like he is sleeping. After having sent a command three times, he wants to wake up.
Is something to be done here ?? This is not very reliable.
wube
Posts: 10
Joined: Wednesday 18 October 2017 12:56
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Cheap Chinese WIFI module

Post by wube »

Hi Everyone,
So I got my sonoff’s recently, and decided to do a little project. I took one of them and changed firmware to espeasy. I used the old night lamp and ordered electric cable (OMY 4×0,5 mm) and switch (WP8A05) *naming convention for switch and cable may be country specific. So in the end i have a whole new cable, on cable switch that goes to gpio14 and all in Domoticz. Everything works, and I can control the lamp both by the physical switch and from domoticz... but! 🙂 .. when i dont add the turnOn rule to control the lamp from domoticz and use the manual on cable switch it works flowlessly, sometimes just minor almost unnoticable delay. but when I add the rule to switch on the lamp to control it via domoticz i get every third time a double click syndrom it means that when i turn the lamp off i see in domoticz log that two commands were sent, first one off and second one On again so my lamp turnes off and on again with just one click. Do you have any idea how to correct that behaviour?

here are my rules:

Code: Select all

on PhysicalButton#Switch do
 if [PhysicalButton#Switch] = 1
 gpio,12,1 // close
 gpio,13,0 // led on
 else 
 gpio,12,0 // open
 gpio,13,1 // led off
 endif
endon

on turnOn do
 gpio,12,1 // close
 gpio,13,0 // led on
endon

on turnOff do
 gpio,12,0 // open
 gpio,13,1 // led off
endon
User avatar
philchillbill
Posts: 396
Joined: Monday 12 September 2016 13:47
Target OS: Linux
Domoticz version: beta
Location: Eindhoven. NL
Contact:

Re: Cheap Chinese WIFI module

Post by philchillbill »

I also found over several weeks of using sonoffs with Domoticz that switching wasn't always reliable. I solved this by getting the on/off actions in Domoticz to kick off a perl job that will keep sending commands to the sonoff until it reports back (via JSON) that it's current state really is the state intended by Domoticz. Feel free to take ideas from it. The script on/off commands in Domoticz now look like:

script://exec.sh ipswitch swGuestroomLamp on
script://exec.sh ipswitch swGuestroomLamp off

where the perl code below is in a file named ipswitch.pl and the contents of exec.sh are

Code: Select all

#! /bin/sh
/usr/bin/perl /home/pi/domoticz/scripts/$1.pl $2 $3 > /dev/null 2>&1 &
Note that if you don't wrap calls to external scripts that cause significant delays in a shell script with an '&' at the end, Domoticz will wait for the external script to finish and you don't want that.

Here's the code that actually talks back and forth to the sonoff:

Code: Select all

#!/usr/bin/perl
use JSON::XS;
use LWP::UserAgent;
no warnings 'uninitialized';

# sets a Sonoff device on/off on behalf of Domoticz and then checks that it actually switched accordingly (in case of packet-loss)

($device, $action, $dbg)=@ARGV; # e.g. swGuestroomLamp, on / off
our $debug = ( $dbg == 1 ) || 0; $action=lc($action); $tries=0;

%sonoffs=(
 swWardrobeLamp => 	{ ip => '27', idx => '388' },
 swAudioengines => 	{ ip => '29', idx => '387' },  
 swBedroomLamp =>	{ ip => '33', idx => '393' }, 
 swGuestroomLamp => 	{ ip => '34', idx => '394' }, 
);


$ua=LWP::UserAgent->new; $ua->timeout(1); $ua->env_proxy;

do {
 # First send the command to the Sonoff
 $url="http://192.168.178.".$sonoffs{$device}{ip}."/control?cmd=event,lamp_$action"; $c=0;
 do { $c++;
  $response=$ua->get($url); 
 } until ( ($response->is_success) || ($c==5) );

 # Now check if it reacted
 $url="http://192.168.178.".$sonoffs{$device}{ip}."/json"; $c=0;
 do {
  sleep 1; $c++;
  $response=$ua->get($url); 
 } until ( ($response->is_success) || ($c==10) );

 if ($response->is_success) {
  $devices=$response->decoded_content; $data=decode_json $devices;
  foreach $entry (@{$$data{Sensors}}) {
   foreach $x (sort keys %{$entry}) { if ($$entry{$x} eq 'relay') { $state=$$entry{state} } }; 
 }};

 $ok=( ($action eq 'off') && ($state==0) ) || ( ($action eq 'on') && ($state==1) ); $tries++;
 
} until ( ($ok) || ($tries==5) );

print "$device: $action --> $state\n" if ($debug);
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest