[How To] integrate a Tasmota device in Home Assistant using MQTT

QIoT technology to allow you to explore potential IoT business opportunities.
Smart home/Smart building/Smart City/
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

oyvindo
Can you help me, I have posted here: viewtopic.php?f=364&t=157692&p=773541&h ... nt#p773541
I am not even sure I install HA properly, I have no idea where to find configuration.yaml
Here is a link to the instructions I followed: https://poyu.co.uk/2020/07/10/setup-hom ... ing-docker
I get to the heading "Add QNAP Sensor" then I get lost, no file exists, not that I can find. I'm about to totally give up the whole IoT idea. I have several WIFI stuff, all with their own app. It would be nice to get it all in one spot. I am now hoping your article here will help in one last ditch attempt. I need a bit of guidance.
I also to be able to add custom dashboards in HA, but from what I have found is they say it can't be done with a docker install. It has been so frustrating.
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

That guide you've been following is not the way I've done things. Here's a few tips:

1. Never choose "latest", but choose instead a specific version. Currently the most recent version is 0.118.5
2. Do't use NAT mode. Use instead Host mode. Home Assistant works close to the HW-layer and it doesn't like to be hidden behind a Network Address Translation wall.
3. In the Shared Folder Setting, don't use "New Volume" use instead "Volume From Host" and make sure your Mount Point is named /config

The Volume From host path is where you'll eventually find your configuration.yaml file.

Drop the Mobile client for now. It serves no purpose until you've actually had HA up'n running for some time and successfully been able to add automations and devices to it. Then you can start playing with the Mobile client.
ImageImageImage
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

Thanks for the quick reply, I will give that a go and post my results.
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

In Network, my choices are:
NAT
Host
Bridge

I cannot type anything in. When I select Host I get this message:

The port may conflict with the NAS port when selecting Host mode.
Use local host network (command: --net=host)
Note:This option allows containers to have full access to the host network interface.

Where is a good location for /config
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

That's right - some of these parameters can only be changed during install.
Never mind the Host warning.

A good location for /config is i.e. if you create a subfolder under your Public Folder.
ImageImageImage
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

I created a shared folder /homeassistant
Then I created a folder config
/homeassistant/config

I select homeassistant folder in the install
log file says it cannot find config and creates it
I cannot find the config files anywhere
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

You cannot create subfolders and expect HA to understand what you have on your mind.
If you select the folder named homeassistant as your Share Folder selection, then that's the one it will use. It ignores whatever subfolders you have created, but it will create its own when needed.
What you should do, is name the Mount Point = /config If you don't do that, HA has no way of knowing what you want.
ImageImageImage
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

I will have to get back to you later. I thought it would be a good idea to clean-up my container station. When it didn't do what I expected, I searched google and found some ssh commands that claimed "how to do it". It sure did, container no longer opens, as well a few other apps. So I will be spending time trying to get everything working again. I am hoping a simple remove/install gets me back up. On top of that, it now needs to do a file system check.

OPPS. Stupid Bob
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

I got it!
You said:
1. Never choose "latest", but choose instead a specific version. Currently the most recent version is 0.118.5
2. Do't use NAT mode. Use instead Host mode. Home Assistant works close to the HW-layer and it doesn't like to be hidden behind a Network Address Translation wall.
3. In the Shared Folder Setting, don't use "New Volume" use instead "Volume From Host" and make sure your Mount Point is named /config

I created a new shared folder /homeassistant
I created a new folder /config inside homeassistant /homeassistant/config (like you said, install did not use this folder)
During install, I choose 0.118.5
I changed NAT to Host in network settings and selected the shared folder /homeassistant
for mount point I typed in /config
The reason it did not put the files in the homeassistant folder was I did not include the back slash. Because of the way it looks I assumed it was for a folder but (to me) it works like a command switch.

Thx very much oyvindo
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

You do not need to create a folder named /config inside /homeassistant. But if you do - it will not be used. If you have already done it, you can safely leave it empty or simply delete it.
ImageImageImage
vskal
Starting out
Posts: 29
Joined: Sun Jul 05, 2020 4:57 pm

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by vskal »

Thank you so much for taking the time for a tutorial.
Very detailed, great stuff !

Trying to get Mqtt working but with Homebridge and the Mttqthings plugin instead.
Using the Shelly plugin already automatically exposed the Shelly plug S but not the Shelly Duo lamp.
So I read Mqtt can provide the required telemetry.

I followed your steps and I am now at the final stage of the config file.
My mosquitto.conf file is empty so I must be setting the broker wrongly.

My Mosquitto container file settings show like this (Volume mount) :
Shared Folders
/mosquitto/log /share/Mosquitto 1/log
/mosquitto/config /share/Mosquitto 1/config
/mosquitto/data /share/Mosquitto 1/data

The mqtt console shows:
Console

1612305144: mosquitto version 1.6.12 starting
1612305144: Config loaded from /mosquitto/config/mosquitto.conf.
1612305144: Opening ipv4 listen socket on port 1883.
1612305144: Opening ipv6 listen socket on port 1883.
1612305144: mosquitto version 1.6.12 running
1612305144: New connection from 192.168.1.12 on port 1883.
1612305144: New client connected from 192.168.1.12 as mqttthing_shellyduo_XXXXXXXX (p2, c1, k30).
1612305147: New connection from 192.168.1.202 on port 1883.
1612305147: New client connected from 192.168.1.202 as shellycolorbulb-XXXXXXXXX (p2, c1, k60).

Part of the Homebridge .json config file looks like this after the plugins and some attempts to comuunicate:

"mqtt": {
"broker": "192.168.1.12",
"port": "1883",
"client_id": "Homebridge"
},
"accessories": [
{
"type": "lightbulb-RGBW",
"name": "shellyduo",
"url": "192.168.1.12:1883",
"mqttOptions": {
"keepalive": 30
},
"mqttPubOptions": {
"retain": true
},
"logMqtt": true,
"topics": {
"getOn": "shellies/shellycolorbulb-XXXXXXXXXXX/status",
"setOn": "shellies/shellycolorbulb-XXXXXXXXXXX/power"
},
"onlineValue": "Online",
"offlineValue": "Offline",
"confirmationPeriodms": 1000,
"retryLimit": 5,
"confirmationIndicateOffline": true,
"integerValue": true,
"onValue": "Online",
"offValue": "Offline",
"accessory": "mqttthing"
}

Homebridge console shows no response when activating the lamp from homekit:
[shellyduo] Setting accessory state to offline
[shellyduo] Publishing MQTT: shellies/shellycolorbulb-XXXXXXXXXXX/power = Online
[shellyduo] Unresponsive - no confirmation message received on shellies/shellycolorbulb-XXXXXXXXXXXXXX/status. Expecting [Online]

Am I far from getting this to work?
User avatar
Cadtoon
Starting out
Posts: 16
Joined: Wed Sep 26, 2018 12:56 pm
Location: Calgary, Alberta

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by Cadtoon »

I'm currently working on some ESP tutorials. One of my projects in mind is a modified alarm clock. To cut corners I plan to use MQTT to set alarm time. Motion detection will turn alarm off.
I am and will continue to follow this post.
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

vskal wrote: Wed Feb 03, 2021 7:25 am Thank you so much for taking the time for a tutorial.
Very detailed, great stuff !

Am I far from getting this to work?
Thank you for your positive feedback.
But regretfully I do not know much about the HomeKit or HomeBridge except that HomeKit is an Apple product, and as such - Apple is always doing everything in its power to prevent people from integration their stuff into any other ecosystem than theirs.
While Homebridge is a product designed to brake out of these limitations imposed by Apple.... Am I right ?

If so, you are asking for difficulties all the way when you work against Apple.
So why not just drop their ecosystem completely and go for a ConBee II ZigBee Gateway instead ?
ImageImageImage
vskal
Starting out
Posts: 29
Joined: Sun Jul 05, 2020 4:57 pm

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by vskal »

Dear oyvindo

Yes, Homebridge exposes devices to Homekit and yes Apple tries to lock their synergies, the same way most manufacturers try to do.

Indeed homekit with the GUI and plugins is quite easy to set up and makes most of the devices usable.
If I set my homekit correctly all the family enjoys the smart home instantly without any further steps.
Futrhtermore, with Apple, controlling home devices through the net and even Siri voice commands are more secure as far as I have read.
I guess the choice depends on how deep each user is in the Apple ecosystem, like me.

The other pivotal point to choose is the network and I believe wifi provides a wider choice of devices and better connectivity.
That is why I went for Shelly products and I guess the same applies for you since you are using the Sonoff switch.
We are all aiming at a unified system.

I will keep on the search to find a detailed post like yours for Mqtt with Homebridge.
All the best !
User avatar
oyvindo
Experience counts
Posts: 1399
Joined: Tue May 19, 2009 2:08 am
Location: Norway, Oslo

Re: [How To] integrate a Tasmota device in Home Assistant using MQTT

Post by oyvindo »

Likewise, but just for the record; I abandoned Wi-Fi in favor of ZigBee.
(Apparently, Sonoff has done the same)
Wi-Fi was never designed for smalltalk between devices. The overhead is way too heavy and the protocol doesn't work well with battery operated devices designed to go to sleep all the time.
ZigBee and Z-Wave were designed with home automation in mind.
I think the reason many manufacturers still offer WiFi products is because people have heard of WiFi which makes the buying decision easier for them.

My advise; Stay away from Wi-Fi devices unless your device is a bandwidth hog.
ImageImageImage
Post Reply

Return to “QIoT”