HASSIO Sonoff Basic showing unavailable

Ok I need your help. I have read and watched almost every video and post on setting up a tasmota sonoff basic in hassio with mosquito. Only place I see my switch is in Unused entities.
I’m ready to ditch hass.io LOL
Here’s what I got:
.2 = hassio / mqtt broker
.5 = sonoff basic
.101 = my laptop

switch
configuration.yaml

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
device_tracker:
  - platform: nmap_tracker
    hosts: 10.0.0.1/24
    interval_seconds: 30
person:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123
switch:
  - platform: mqtt
    name: Sonoff
    unique_id: dc4f22f8a4c2
    state_topic: “stat/sonoff/POWER”
    command_topic: “cmnd/sonoff/POWER”
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: false 
# Text to speech
tts:
  - platform: google_translate
frontend:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

MQTT Configs

{
  "logins": [
    {
      "username": "connect",
      "password": "PASSWORD"
    }
  ],
  "anonymous": false,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

MQTT ACL

user connect
user homeassistant
topic readwrite #

Logs

[06:54:59] INFO: Setup mosquitto configuration
[06:54:59] WARNING: SSL not enabled - No valid certs found!
[06:55:00] INFO: Found local users inside config
[06:55:00] INFO: Initialize system configuration.
[06:55:00] INFO: Initialize Hass.io Add-on services
[06:55:00] INFO: Initialize Home Assistant discovery
[06:55:00] INFO: Start Mosquitto daemon
1565178900: Loading config file /share/mosquitto/acl.conf
1565178900: mosquitto version 1.6.3 starting
1565178900: Config loaded from /etc/mosquitto.conf.
1565178900: Loading plugin: /usr/share/mosquitto/auth-plug.so
1565178900: |-- *** auth-plug: startup
1565178900:  ├── Username/password checking enabled.
1565178900:  ├── TLS-PSK checking enabled.
1565178900:  └── Extended authentication not enabled.
1565178900: Opening ipv4 listen socket on port 1883.
1565178900: Opening ipv6 listen socket on port 1883.
1565178900: Opening websockets listen socket on port 1884.
1565178900: Warning: Mosquitto should not be run as root/administrator.
1565178902: New connection from 10.0.0.5 on port 1883.
[INFO] found connect on local database
1565178903: New client connected from 10.0.0.5 as DVES_F8A4C2 (p2, c1, k30, u'connect').
1565178909: New connection from 10.0.0.2 on port 1883.
1565178909: New client connected from 10.0.0.2 as homeassistant (p2, c1, k60, u'connect').
1565179007: Client homeassistant disconnected.
1565179023: New connection from 10.0.0.2 on port 1883.
1565179023: New client connected from 10.0.0.2 as homeassistant (p2, c1, k60, u'connect').
1565179285: New connection from 10.0.0.101 on port 1883.
[INFO] found connect on local database
1565179286: New client connected from 10.0.0.101 as lens_kOA0Wv6fgH7g61xcpsfgsA5n5NN (p1, c1, k120, u'connect').
1565179490: Client lens_kOA0Wv6fgH7g61xcpsfgsA5n5NN disconnected.
1565179490: New connection from 10.0.0.101 on port 1883.
1565179490: New client connected from 10.0.0.101 as lens_1I9lD7ZXSW7VFC5STvyc9mNJfu7 (p1, c1, k120, u'connect').
1565179616: Client homeassistant disconnected.
1565179642: New connection from 10.0.0.2 on port 1883.
[INFO] found connect on local database
1565179643: New client connected from 10.0.0.2 as homeassistant (p2, c1, k60, u'connect').

MQTT Lens was working but now it won’t publish since I enabled acl

Your switch config is using fancy double quotes:

switch:
  - platform: mqtt
    name: Sonoff
    unique_id: dc4f22f8a4c2
    state_topic: “stat/sonoff/POWER”
    command_topic: “cmnd/sonoff/POWER”
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: false 

Should be:

switch:
  - platform: mqtt
    name: Sonoff
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/POWER"
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: false 

Your other option is to delete the whole switch config and using the Tasmota console (in the web interface for the device)

SetOption19 = 1

Then restart HA.

This will enable discovery and you should see the switch in the configuration / mqtt integrations panel.

You also don’t appear to have SSL certificates so it won’t be using a secure connection. Not a huge issue for a local network.

deleted and SetOption19 = 1 then restarted. That resulted in nothing.

I fixed the weird quote marks…that was strange I don’t know where they came from. My sonoff went from showing unavailable to off
sonoff

it was still in unused. I added a card but the switch does nothing when clicked.
switch

1565183147: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1565183148: New client connected from 172.30.32.1 as auto-98B03EEF-9A92-C9F0-797D-7B0EDB104FBB (p2, c1, k60, u'homeassistant').
1565183148: Client auto-98B03EEF-9A92-C9F0-797D-7B0EDB104FBB disconnected.
1565183148: New connection from 172.30.32.1 on port 1883.
1565183148: New client connected from 172.30.32.1 as auto-09D7BD57-AAA0-F320-7990-7AB7C664D3ED (p2, c1, k60, u'homeassistant').
1565183175: Client auto-09D7BD57-AAA0-F320-7990-7AB7C664D3ED disconnected.
1565183196: New connection from 172.30.32.1 on port 1883.
1565183196: New client connected from 172.30.32.1 as auto-818FA05D-E970-0EF4-9AC5-F7A9075BEDE2 (p2, c1, k60, u'homeassistant').
1565183413: Client auto-818FA05D-E970-0EF4-9AC5-F7A9075BEDE2 disconnected.
1565183436: New connection from 172.30.32.1 on port 1883.
1565183436: New client connected from 172.30.32.1 as auto-C0701C3B-F216-58B3-5598-4F4A2A12403C (p2, c1, k60, u'homeassistant').

Do you see the switch in the configuration / integrations / mqtt page?

What happens if you toggle the sonoff from the switch on the device?

no I didn’t see it in integrations
mqtt

the button toggles the light on and off as well as from the sonoff webpage.

I just changed the mosquito config to

"active": false,

and now it is working. hallelujah I’ve been trying to get this to work for a week.

Great news.

That would tend to suggest there is a problem with your ACL.

This may cause you problems in future as an ACL is supposed to be required. It would be worth sorting out.

Have a read of this post: Mosquito update 4.1 - ACL messages in logs

Note there are two files required. Replace my user mqtt_user with your user connect

that’s what I was thinking. basically the acl says that users connect and homeassistant have access the everything. Maybe i need to separate out the users

user connect
user homeassistant
topic readwrite #

to

user connect

topic readwrite #

user homeassistant

topic readwrite #

Oh I completely missed that, sorry. Yes you need to specify which topics each user has access to

This

user connect
user homeassistant
topic readwrite #

Only gives permissions to home assistant. You want:

user connect
topic readwrite #
user homeassistant
topic readwrite #
1 Like

Thank you so much Tom. Your quick replies have been so helpful to my frustration :grinning: Now I’m up and going and have my lights automatically turning off when me and my woman leave home. It’s great.

user connect
topic readwrite #
user homeassistant
topic readwrite # 

Yeah I was just about to post that…

1 Like

updated my acl to your suggestions and reactivated. Now all works correctly thank you all.