Page 3 of 3
Re: Cheap Chinese WIFI module
Posted: Tuesday 28 February 2017 18:55
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/
https://www.itead.cc/wiki/images/f/f7/C ... Series.pdf
Re: Cheap Chinese WIFI module
Posted: Thursday 27 April 2017 20:42
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.
.
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?
Re: Cheap Chinese WIFI module
Posted: Thursday 27 April 2017 20:47
by sincze
mmm Strange.. If I push the button on the Sonoff domoticz is updated and the light is switched on.
Really strange indeed.
Re: Cheap Chinese WIFI module
Posted: Thursday 04 May 2017 21:05
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
Thank you
That´s the only thing which missing in my implementation across house
Re: Cheap Chinese WIFI module
Posted: Sunday 07 May 2017 21:17
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
Re: RE: Re: Cheap Chinese WIFI module
Posted: Monday 08 May 2017 21:57
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
Re: Cheap Chinese WIFI module
Posted: Wednesday 10 May 2017 20:53
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.
Re: RE: Re: Cheap Chinese WIFI module
Posted: Thursday 11 May 2017 8:07
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
Re: Cheap Chinese WIFI module
Posted: Wednesday 31 May 2017 19:35
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 (15.99 KiB) Viewed 4712 times
- 31-05-2017 20-26-15.png (27.22 KiB) Viewed 4712 times
- 31-05-2017 20-26-27.png (26.66 KiB) Viewed 4712 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
Re: Cheap Chinese WIFI module
Posted: Thursday 20 July 2017 23:29
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?
Re: Cheap Chinese WIFI module
Posted: Monday 24 July 2017 11:21
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
Re: Cheap Chinese WIFI module
Posted: Tuesday 25 July 2017 0:43
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
Re: Cheap Chinese WIFI module
Posted: Tuesday 25 July 2017 1:32
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!
Re: Cheap Chinese WIFI module
Posted: Tuesday 25 July 2017 19:42
by Eddiever
The fysical device has one IDX, the second IDX is for the new dummy switch.
Re: Cheap Chinese WIFI module
Posted: Saturday 19 August 2017 21:56
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!
Re: Cheap Chinese WIFI module
Posted: Thursday 28 September 2017 16:38
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.
Re: Cheap Chinese WIFI module
Posted: Tuesday 17 October 2017 18:47
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.
Re: Cheap Chinese WIFI module
Posted: Sunday 04 February 2018 13:22
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
Re: Cheap Chinese WIFI module
Posted: Tuesday 06 February 2018 10:34
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);