Hi,
Let me introduce myself, I'm Alex and I am really into home automation but have hit a stumbling block.
I am trying to set up some Sonoff S20's with Home Assistant but I am COMPLETELY stumped by quite how MQTT works.
I have flashed the Sonoff's with ESP Easy Mega and believe me have searched high and low for help on this forum and elsewhere to no avail.
I don't think I am understanding "topics" very well.
I am trying to use the built in MQTT server in Home Assistant which seems to be fine.
Quite simply I would be very, very grateful if someone with the knowledge could just put in layman's terms where I've gone wrong, what does and doesn't need to be there. Whether this will work at-all:
Configuration file in Home Assistant:
ESP Easy Mega config screen:
ESP Easy Mega controller screen:
ESP Easy Mega devices screen:
ESP Easy Mega rules screen:
With what I have done so far the switch does show up in Home Assistant, as follows (and all other NON-MQTT accessories work):
Pressing the "MQTT Switch" switch does nothing - and the switch goes back to "off" within a second.
All help will be very well received, I'm sure you guys will be able to tell me exactly where I am going wrong!
I must stress please be kind and put things in plain English because this is one thing that is really stumping me and as I say I am a complete noob!
Thank you so much in advance,
Regards,
Alex
Sonoff/ESPEasy/MQTT/HA Noob - please help!
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 4
- Joined: 05 Nov 2017, 18:08
-
- New user
- Posts: 4
- Joined: 05 Nov 2017, 18:08
Re: Sonoff/ESPEasy/MQTT/HA Noob - please help!
Sorry, just one thing I must add -
If I navigate to the following in a web browser:
http://192.168.0.69/control?cmd=GPIO,12,0 - the switch DOES turn off
or
http://192.168.0.69/control?cmd=GPIO,12,1 - the switch DOES turn on
Thanks again.
If I navigate to the following in a web browser:
http://192.168.0.69/control?cmd=GPIO,12,0 - the switch DOES turn off
or
http://192.168.0.69/control?cmd=GPIO,12,1 - the switch DOES turn on
Thanks again.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Sonoff/ESPEasy/MQTT/HA Noob - please help!
The topic from openhab should be
with the payload (message)
By default ESP Easy will listen to its device name (%sysname%) as you set in the controller setup. And the subtopic of commands is "cmd". The payload (some call it message) is the command that you want to send. In the case of your example you would send the payload "GPIO,12,0" to turn GPIO 12 to low.
Code: Select all
/sleeperlights/cmd
Code: Select all
GPIO,12,0
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- New user
- Posts: 4
- Joined: 05 Nov 2017, 18:08
Re: Sonoff/ESPEasy/MQTT/HA Noob - please help!
grovkillen wrote: ↑05 Nov 2017, 20:07 The topic from openhab should be
with the payload (message)Code: Select all
/sleeperlights/cmd
By default ESP Easy will listen to its device name (%sysname%) as you set in the controller setup. And the subtopic of commands is "cmd". The payload (some call it message) is the command that you want to send. In the case of your example you would send the payload "GPIO,12,0" to turn GPIO 12 to low.Code: Select all
GPIO,12,0
Thanks for the prompt response Grovkillen!
So; I’m so sorry to be dumb but more specifically what do the fields need to be in my set up?:
state_topic: “=?”
command_topic: “=?”
And have I set up the rules and devices sections correctly?
Thanks again.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Sonoff/ESPEasy/MQTT/HA Noob - please help!
Concerning ESP Easy it seems right. How you configure OpenHAB to communicate correctly with the ESP Easy unit is beyond my scope.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- New user
- Posts: 4
- Joined: 05 Nov 2017, 18:08
Re: Sonoff/ESPEasy/MQTT/HA Noob - please help!
OK, thanks for you help.
Could anyone else shed any light please?
I tried this in my Home Assistant configuration.yaml file but it still didn't work!
Could anyway please tell me exactly what needs to be in the fields above? I know I'm very close but I just don't know quite where I'm going wrong
Regards,
Alex
Could anyone else shed any light please?
Code: Select all
switch:
- platform: mqtt
mqtt_name: "SleeperLights"
state_topic: "/sleeperlights/status"
command_topic: "/sleeperlights/cmd"
qos: 0
payload_on: "GPIO,12,1"
payload_off: "GPIO,12,0"
optimistic:
retain: true
Could anyway please tell me exactly what needs to be in the fields above? I know I'm very close but I just don't know quite where I'm going wrong
Regards,
Alex
Who is online
Users browsing this forum: No registered users and 90 guests