@hyperx said
Andyone tried SonOFF with DHT22 ?
Look at ESPEasy forum: http://www.esp8266.nu/forum/viewtopic.php?f=5&t=721&hilit=sonoff&start=140#p6980
P.S. I do not know if it’s a good idea.
Sonoff - WiFi Wireless Smart Switch for MQTT COAP Smart Home
@hyperx said
Andyone tried SonOFF with DHT22 ?
Look at ESPEasy forum: http://www.esp8266.nu/forum/viewtopic.php?f=5&t=721&hilit=sonoff&start=140#p6980
P.S. I do not know if it’s a good idea.
Pimatic = Smart Home
@lxz i’m getting the error when i putt the plugin Mqtt in my config.json…any idea ?
{
“plugin”: “mqtt”
}
logfile
Reconnecting to MQTT Broker
13:27:49.565 [pimatic-mqtt] MQTT Broker is offline
13:27:52.929 [pimatic-mqtt] Error on connecting to MQTT Broker operation timed out
13:27:54.573 [pimatic-mqtt] Reconnecting to MQTT Broker
13:27:54.628 [pimatic-mqtt] MQTT Broker is offline
13:27:59.636 [pimatic-mqtt] Reconnecting to MQTT Broker
13:27:59.685 [pimatic-mqtt] MQTT Broker is offline
@krissie said in Sonoff - WiFi Wireless Smart Switch for MQTT COAP Smart Home
@lxz i’m getting the error when i putt the plugin Mqtt in my config.json…any idea ?
Hey,
You’ve installed and launched a MQTT broker? For example Mosquitto?
Pimatic = Smart Home
@wutu
no , i have not installed an MQTT broker ? Is there a how to…for this ? link ?
Hi @krissie,
if you are installing on Raspberry Pi - http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/.
bye
Pimatic = Smart Home
@wutu thanks for the link. I have installed MQTT broker and the erro is gone. butt still nog communication with the Sonoff. Is there a way to check if to check if everything is correct.
is the a way to communicate with the ESP8266 with the IP-adres instead the name…to make pimatic find the sonoff ?
Have you checked the strings of the template?
in the configuration of the esp under tools-> advanced -> the first 2 strings?
Subscribe Template: /%sysname%/#
Publish Template: /%sysname%/%tskname%/%valname%
they must “match” the topic string the the device configuration in pimatic:
e.g. :
{
"class": "MqttSwitch",
"id": "sonoff_1",
"name": "Ganglicht Decke",
"topic": "/sonoff_1/gpio/12",
"state" : "/sonoff_1/state",
"onMessage": "1",
"offMessage": "0"
},
%sysname% is the device name of your Sonoff - in my case sonoff_1 (you find in in the webinterface of esp: -> config -> main settings -> name)
%tskname% is the task name (esp: -> devices -> name) or you can take gpio and in the next step the number of the gpio
%valname% is the name of the value (esp: -> devices -> values ) or the number of the gpio if you choose “gpio” as task name
i´ve choosen the variante with “gpio/12” instead of “relay/state” so i´m not dependant on names!
and i tried it 2 times with names but no success…but i don´t know why!
you can also check what´s send and received my the mqtt server.
use the command: mosquitto_sub -d -t /#
(if the command is not found: sudo apt-get install mosquitto-clients
)
this will subscribe you to all messages that go over the mqtt server and will display them with debug information.
here you should see what happens…
here the log when pimatic send a command to the switch and get´s the answer from the sonoff back:
pi@raspberrypi ~ $ mosquitto_sub -d -t /#
Client mosqsub/13253-raspberry received PUBLISH (d0, q0, r0, m0, '/sonoff_1/gpio/12', ... (1 bytes))
1
Client mosqsub/13253-raspberry received PUBLISH (d0, q0, r0, m0, '/sonoff_1/relay/state', ... (1 bytes))
1
hope this will help you!
thank you for rhe detailled information. Only +I use this configuration
{
“class”: “MqttSwitch”,
“id”: “sonoff_1”,
“name”: “Ganglicht Decke”,
“topic”: “/sonoff_1/gpio/12”,
“state” : “/sonoff_1/state”,
“onMessage”: “1”,
“offMessage”: “0”
},
For the “state” option he is ginving an error… some other users use “StateTopic”…Is there a difference ?
Hey @krissie, @johnny11
In the state topic you’re missing %taskname
"stateTopic": "/sonoff_1/%taskname/state"
EDIT:
@krissie said: is the a way to communicate with the ESP8266 with the IP-adres instead the name…to make pimatic find the sonoff ?
In MQTT, Pimatic not communicate with devices directly, but through brokers.
Pimatic is just another client, even though the most important. This has the advantage that you could Pimatic during maintenance, the use of another client, for example, CLI (mosquitto_sub, mosquitto_pub) or Android app. Or what do you pick
@johnny11 said: i´ve choosen the variante with “gpio/12” instead of “relay/state” so i´m not dependant on names!
and i tried it 2 times with names but no success…but i don´t know why!
This is normal, this is how ESPEasy behave.
Pimatic = Smart Home
Guys, sorry that I’ve written nothing for such a long time. I’m already working on the next projects and I’ve been in vacation for few weeks.
I just wanted to thank you ass rocking experts so much. My Sonoff devices are running fine since you supported me so paitently. I will donate you a beer if that will be possible once a day !
Keep on guys!
@llgb said in Sonoff - WiFi Wireless Smart Switch for MQTT COAP Smart Home:
I will donate you a beer if that will be possible once a day !
well, you can donate to pimatic if you like to
you can also receive some nice free stickers for your enclosures or whatever you like to stick them to …
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
Now you can buy Sonoff Dual.
Pimatic = Smart Home
Just came here to say thanks to all contributors for this topic. After soldering in my headers (which was the hardest part!) i was able to get this relay up&running in 15 minutes! (using R108)
@wutu
and it has 16A relais. (The plain sonoff has only 10A.)
@wutu said in Sonoff - WiFi Wireless Smart Switch for MQTT COAP Smart Home:
Add rules to ESPEasy:
on relay#state do
if [relay#state]=0
gpio,13,1
else
gpio,13,0
endif
endon
on button#state do
if [button#state]=0
gpio,12,0
gpio,13,1
else
gpio,12,1
gpio,13,0
endif
endon
@wutu I’ve installed espEasy but have no option “Rules”. Do I need to activate that somehow? I’m using latest version R120
Tools -> Advanced: switch on Rules. Then you can use them.
thanks
Did anyone use GPIO 14 (the spare pad on J1) to connect an external switch? I want to use this to switch the light locally, independent from the controller.
As the sonoff has a transformer it should be safe isn’t it? And the switch I want to use is a normal wall switch so that in insulated for these high voltages (if there are).
So, suppose you power the Sonoff with 230V and touch this pad 5. Will you touch mains or 3v3?
Hello,
I got my Sonoffs yesterday and tried to use them with MQTT. Config in attachment. Where is my bug?
Daniel
Got some sonoff devices last week. I flashed them with Tasmota FW and all works well with the pimatic-mqtt-plugin. Also the status in pimatic is updating correctly over mqtt.
Big thanks @wutu
Sonoff 10A
{
"class": "MqttSwitch",
"id": "mqttsonoffswitch",
"name": "MqttSonoffSwitch",
"topic": "cmnd/sonoff/Power",
"stateTopic": "stat/sonoff/POWER",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"class": "MqttSwitch",
"id": "mqttsonoffPOWswitch",
"name": "MqttSonoffPowSwitch",
"topic": "cmnd/sonoffPOW/Power",
"stateTopic": "stat/sonoffPOW/POWER",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"class": "MqttSensor",
"id": "mqttsonoffPOWinfo",
"name": "MqttSonoffPowInfo",
"attributes": [
{
"name": "ENERGY.Yesterday",
"topic": "tele/sonoffPOW/SENSOR",
"type": "number",
"unit": "kWh",
"acronym": "Gestern"
},
{
"name": "ENERGY.Today",
"topic": "tele/sonoffPOW/SENSOR",
"type": "number",
"unit": "kWh",
"acronym": "Heute"
},
{
"name": "ENERGY.Current",
"topic": "tele/sonoffPOW/SENSOR",
"type": "number",
"unit": "A",
"acronym": "I"
},
{
"name": "ENERGY.Voltage",
"topic": "tele/sonoffPOW/SENSOR",
"type": "number",
"unit": "V",
"acronym": "U"
},
{
"name": "ENERGY.Power",
"topic": "tele/sonoffPOW/SENSOR",
"type": "number",
"unit": "W",
"acronym": "P"
}
]
},
By default the device sends every 5 minutes the energy data. You can change this interval with the command TelePeriod <seconds>
in the console or by url http://<ip>/cm?cmnd=TelePeriod <seconds>
Sonoff 4CH for DIN Rail (Hutschine)
This device has a ESP8285. When flashing with Arduino, select “Generic ESP8285 Module” as boardtype. It seems that the labeling for TX/RX on the circuit board are reversed. I had to connect TX<–>TX RX<–>RX.
{
"class": "MqttSwitch",
"id": "mqttsonoff4chSswitch1",
"name": "MqttSonoff4chSwitch1",
"topic": "cmnd/sonoff4ch/Power1",
"stateTopic": "stat/sonoff4ch/POWER1",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"class": "MqttSwitch",
"id": "mqttsonoff4chSswitch2",
"name": "MqttSonoff4chSwitch2",
"topic": "cmnd/sonoff4ch/Power2",
"stateTopic": "stat/sonoff4ch/POWER2",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"class": "MqttSwitch",
"id": "mqttsonoff4chSswitch3",
"name": "MqttSonoff4chSwitch3",
"topic": "cmnd/sonoff4ch/Power3",
"stateTopic": "stat/sonoff4ch/POWER3",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"class": "MqttSwitch",
"id": "mqttsonoff4chSswitch4",
"name": "MqttSonoff4chSwitch4",
"topic": "cmnd/sonoff4ch/Power4",
"stateTopic": "stat/sonoff4ch/POWER4",
"onMessage": "ON",
"offMessage": "OFF"
},
{
"name": "MQTTButtons",
"id": "mqtt-4ch-buttons",
"class": "MqttButtons",
"buttons": [
{
"id": "mqtt-sonoff4ch-button1",
"text": "1",
"topic": "cmnd/sonoff4ch/POWER1",
"message": "2",
"stateTopic": "stat/sonoff4ch/POWER1"
},
{
"id": "mqtt-sonoff4ch-button2",
"text": "2",
"topic": "cmnd/sonoff4ch/POWER2",
"message": "2",
"stateTopic": "stat/sonoff4ch/POWER2"
},
{
"id": "mqtt-sonoff4ch-button3",
"text": "3",
"topic": "cmnd/sonoff4ch/POWER3",
"message": "2",
"stateTopic": "stat/sonoff4ch/POWER3"
},
{
"id": "mqtt-sonoff4ch-button4",
"text": "4",
"topic": "cmnd/sonoff4ch/POWER4",
"message": "2",
"stateTopic": "stat/sonoff4ch/POWER4"
}
]
}
To enter the flashmode connect GPIO0 to Ground.
Sonoff DUAL
To enter flashmode connect GPIO0 to GND
@magic-tune thx for your investigations!
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !