Sonoff switch config issues

I seem to be struggling here with regards to connecting my sonoff switch to hassio. I currently have this https://www.amazon.co.uk/VIGICA-Wireless-Control-Automation-Intelligent/dp/B071K649KD/ref=sr_1_1_sspa?ie=UTF8&qid=1526849149&sr=8-1-spons&keywords=sonoff&psc=1 How do i go about installing it to hassio, i have setup MQTT with my user name and password for hassio and put the following into my config file but it then says that it cant set up mqtt and switch.mqtt do i need to install tamasto? or what would i need to do?

switch:
- platform: mqtt
name: “Lamp1”
state_topic: “stat/sonoffpow2/POWER”
command_topic: “cmnd/sonoffpow2/POWER”
qos: 0
payload_on: “ON”
payload_off: “OFF”
retain: true

Try this:

switch:
  - platform: mqtt
    name: “Lamp1”
    state_topic: “stat/sonoffpow2/POWER”
    command_topic: “cmnd/sonoffpow2/POWER”
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

Have you set up a broker and the mqtt: component?

I added the broker

mqtt:
broker: 172.xx.x.xx

it then works fine and i receive this message in MQTT

1526890621: New connection from 172.x.x.xx on port xxx.
1526890621: New client connected from 172.x.x.xx as xxxxxxxxxxxxxxxxxxxxx

I take it that it means that it found the sonoff switch.

switch:

  • platform: wake_on_lan
    mac_address: “xxxxxxx”
    name: “pc”
    host: “xxxxxxx”
  • platform: mqtt
    name: “Lamp1”
    state_topic: “stat/sonoffpow2/POWER”
    command_topic: “cmnd/sonoffpow2/POWER”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    retain: true
    Now when adding the above to my already existing switch this is what i get when checking config file.

Error loading /config/configuration.yaml: while parsing a block collection
in “/config/configuration.yaml”, line 188, column 2
expected , but found ‘’
in “/config/configuration.yaml”, line 199, column 3

with line 188 being wake on lan and then 199 being the retain: true

Did you install tamasto on the sonoff

no but why would i need to? i thought it was like adding hue lights which are also just wifi enable

Good, you are most of the way there.

You need to post your yaml snippet using the instructions in the blue box at the top of the post, so we can see it properly.

But judging from the error message, I think you need to check the quotes. Either you have them mismatched (possibly from earlier in the configuration), or they are of the wrong type - which editor did you use?

Edit:
But @myle is correct, you need to install the tasmota software on the sonoff, I understand it doesn’t have it by default.

I used notepad++
with installing tasmota does that mean i need to get that addon board to allow me to connect it to my pc?

Yes. OTA to flash Sonoff doesn’t work with latest Sonoff firmware

Okay then I will flash it and then let you know of the progress

Once you have done couple it get easyer and it will open a hole new world I even Put Tasmota on wemos and having heaps of fun with them

here

What board would i need?

https://www.diyelectronics.co.za/store/programmer/35-avr-isp-usbasp-atmel-avr-programmer.html
Would this be okay to use?

You need one of these:
USB UART TTL 3.3V Converter/Programmer (e.g. CP2102, CH340G, FT232, PL2303)
Also check out my blog post with step by step.
I just searched ebay for CP2102 and pretty much got the first one that came up. Cost ~ USD$5

Thanks so much