Tassmota Switch is always unavailable

Hi there,
I am trying to get a tasmota switch working under mqtt without much luck. The switch is always unavailable.

Tasmota works fine. I can toggle the switch via it’s local web page.
I have setup mqtt on it, and assigned a login/passwork.

user: mqtt_user
topic: tasmota_C0247B

This is it’s console output:

00:00:00 CFG: Loaded from flash at F9, Count 83
00:00:00 Project tasmota Tasmota Version 8.4.0(tasmota)-2_7_2_1
00:00:00 WIF: Connecting to AP1 SPACE Channel 1 BSSId 00:1D:AA:80:29:28 in mode 11N as tasmota_C0247B-1147...
00:00:01 WIF: Connected
11:51:10 HTP: Web server active on tasmota_C0247B-1147 with IP address 192.168.1.148
11:51:11 MQT: Attempting connection...
11:51:11 MQT: Connected
11:51:11 MQT: tele/tasmota_C0247B/LWT = Online (retained)
11:51:11 MQT: cmnd/tasmota_C0247B/POWER = 
11:51:11 MQT: tele/tasmota_C0247B/INFO1 = {"Module":"Arlec-PC190HA","Version":"8.4.0(tasmota)","FallbackTopic":"cmnd/DVES_C0247B_fb/","GroupTopic":"cmnd/tasmotas/"}
11:51:11 MQT: tele/tasmota_C0247B/INFO2 = {"WebServerMode":"Admin","Hostname":"tasmota_C0247B-1147","IPAddress":"192.168.1.148"}
11:51:11 MQT: tele/tasmota_C0247B/INFO3 = {"RestartReason":"Software/System restart"}
11:51:11 MQT: stat/tasmota_C0247B/RESULT = {"POWER":"OFF"}
11:51:11 MQT: stat/tasmota_C0247B/POWER = OFF (retained)
11:51:15 MQT: tele/tasmota_C0247B/STATE = {"Time":"2020-08-15T11:51:15","Uptime":"0T00:00:09","UptimeSec":9,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SPACE","BSSId":"00:1D:AA:80:29:28","Channel":1,"RSSI":76,"Signal":-62,"LinkCount":1,"Downtime":"0T00:00:03"}}
11:56:15 MQT: tele/tasmota_C0247B/STATE = {"Time":"2020-08-15T11:56:15","Uptime":"0T00:05:09","UptimeSec":309,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SPACE","BSSId":"00:1D:AA:80:29:28","Channel":1,"RSSI":76,"Signal":-62,"LinkCount":1,"Downtime":"0T00:00:03"}}
12:01:06 APP: Serial logging disabled
12:01:15 MQT: tele/tasmota_C0247B/STATE = {"Time":"2020-08-15T12:01:15","Uptime":"0T00:10:09","UptimeSec":609,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SPACE","BSSId":"00:1D:AA:80:29:28","Channel":1,"RSSI":78,"Signal":-61,"LinkCount":1,"Downtime":"0T00:00:03"}}

mqtt moquito broken is installed. With the same login/password I used on the tasmota switch.
Here is it’s config:

logins:
  - username: mqtt_user
    password: xxx
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

This is it’s log output:

[20:50:52] INFO: Setup mosquitto configuration
[20:50:52] WARNING: SSL not enabled - No valid certs found!
[20:50:52] INFO: Found local users inside config
[20:50:52] INFO: Initialize Hass.io Add-on services
[20:50:52] INFO: Initialize Home Assistant discovery
[20:50:52] INFO: Start Mosquitto daemon
1597488652: mosquitto version 1.6.3 starting
1597488652: Config loaded from /etc/mosquitto.conf.
1597488652: Loading plugin: /usr/share/mosquitto/auth-plug.so
1597488652: |-- *** auth-plug: startup
1597488652:  ├── Username/password checking enabled.
1597488652:  ├── TLS-PSK checking enabled.
1597488652:  └── Extended authentication not enabled.
1597488652: Opening ipv4 listen socket on port 1883.
1597488652: Opening ipv6 listen socket on port 1883.
1597488652: Opening websockets listen socket on port 1884.
1597488652: Warning: Mosquitto should not be run as root/administrator.
1597488653: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1597488654: New client connected from 172.30.32.1 as auto-17D5CD85-352F-BEA4-19DB-435A55CFC68F (p2, c1, k60, u'homeassistant').
1597488658: New connection from 192.168.1.148 on port 1883.
[INFO] found mqtt_user on local database
1597488659: New client connected from 192.168.1.148 as DVES_C0247B (p2, c1, k30, u'mqtt_user').
1597488667: Socket error on client DVES_C0247B, disconnecting.
1597488671: New connection from 192.168.1.148 on port 1883.
1597488671: New client connected from 192.168.1.148 as DVES_C0247B (p2, c1, k30, u'mqtt_user').

192.168.1.148 is the ip of my tasmota switch.
I am unsure what ip 172.30.32.1 is?? does this seem normal getting this request?

If I look at the mqtt integration, it is setup with:


NOTE: This is not from a comfig file. i copied the values from the integration Ui

broker: core-mosquitto
port: 1883
username: homeassistant
password: a very long password.

I never set these, they seemed to be auto setup for me.

and finally, I set up my switch as follows in my configuration.yaml:

switch:
   platform: mqtt
   name: Deta PCB
   command_topic: “cmnd/tasmota_C0247B/POWER”
   state_topic: “stat/tasmota_C0247B/POWER”
   availability_topic: “tele/tasmota_C0247B/LWT”
   qos: 1
   payload_on: “ON”
   payload_off: “OFF”
   payload_available: “Online”
   payload_not_available: “Offline”
   retain: false

I can see the entity, in the entities list -> switch.deta_pcb

but when I add it to a lovellace card. It appears but always is unavailable.

I’ve been stuck on this for hours, and have many youtube clips nd can’t seem to see what I am doing which is different to them…

Any help would be greatly appreciated.
Thanks

1 Like

Is this in your configuration.yaml file?

If so, remove it, restart, and set up the broker through the UI (configuration / integrations, +, mqtt)

This is the internal Home Assistant docker network. Yes it is normal.

Replace all the fancy quotes in your switch config with straight ones ". Restart and try again.

2 Likes

Hi Tom, no sorry, thats the fields from the UI. not the yaml file. i opied them just to show what they were…

I just added an extra bit on the end of my reply.

1 Like

You’re a champion. That was it :slight_smile: :slight_smile: :slight_smile:
I so didn’t notice those wierd quotes. Musy have been copy and pasting the code.
Thank you very much

1 Like

You are the boss sir.