Integrate Wemos D1 with mqtt

I want to monitor the power useage of my house and i set up my Wemos D1 following this tutorial:

http://adl517.at/index.php/seitenmenue/25-zaehler-lesekopf (Sorry, it is german)…

I filled in the Mqtt settings in the interface and the Wemos is connected to wifi.

How can i integrate this device in Home Assistant?

thanks!

I already tried to set it up like this, but the device is not found…

Paste your correctly formatted configuration for the sensor here for help.

i added this to my configuration.yaml:

sensor:

  • platform: mqtt
    state_topic: “stromzaehler”

In the configuration of the Wemos i have this as MQTT First Topic: stromzaehl

What messages do you see on that topic?

You can use mqtt explorer to see.

Which mqtt broker are you using?

Hey @Flo_93 did you enter setoption19 on into the terminal to enable MQTT auto discovery? Sounds like you are almost there, you can check out this section my MQTT tutorial to complete your Tasmota setup :slight_smile:

I looked at that web page but wasn’t sure it was Tasmota or just something that looked like it.

I wrote about using an SCT sensor to monitor current and send the data to HASS a couple years ago. That Wemos has been running solid since then. This might help you out:

Good point, yes you’re right! It does look a lot like Tasmota! It doesn’t look like the code is shared either, only a .bin file.

The problem is, on the wemos firmware i cant get into the console and i cant enable auto discovery…
I also think it is not Tasmota, just the look is alike…

I am using Mosquitto Broker

Just use esphome.

I would love to…
But i dont know how to program it…
I need to use an api code from my power supplier to get the values out of the smart meter…

Using this premade firmware seemed to be a good idea for me… But i just cant get mqtt to work…

It really looks very close to the standard Tasmota config interface.
Can you paste a screenshot of how you’ve set up MQTT and we can take a look at it - i.e. the equivalent of this:

I always find the setup for retrieving the state and topic a little tricky with Tasmota because the root topic is often something like /tele or /cmnd

I almost always need to take a look at the MQTT Explorer in order to figure it out.

this is my config…

thanks for taking a look :slight_smile:

Can’t say anything from that config. Install MQTT Explorer or MQTT.FX, isten to stromzaehler/# and post what you receive here.

I agree with @francisp - the ‘sending side’ looks correct.
MQTT Explorer will help you find out what the ‘receiving side’ should look like - maybe you can post a screenshot as well.

Thanks, i will try that :slight_smile:

This is MQTT Explorer right now:


Mosqitto Log says:

1586972064: New connection from 192.168.1.6 on port 1883.
[INFO] found mqtt on local database
1586972067: New client connected from 192.168.1.6 as AMIS Stromzähler84:F3:EB:E3:84:06 (p2, c1, k10, u’mqtt’).
1586972067: Socket error on client AMIS Stromzähler84:F3:EB:E3:84:06, disconnecting.
1586972067: New connection from 192.168.1.6 on port 1883.
1586972067: New connection from 192.168.1.6 on port 1883.
1586972067: New client connected from 192.168.1.6 as AMIS Stromzähler84:F3:EB:E3:84:06 (p2, c1, k10, u’mqtt’).
1586972067: Client AMIS Stromzähler84:F3:EB:E3:84:06 already connected, closing old connection.
1586972067: New client connected from 192.168.1.6 as AMIS Stromzähler84:F3:EB:E3:84:06 (p2, c1, k10, u’mqtt’).
1586972233: Saving in-memory database to /data/mosquitto.db.

So Mosqitto connects to the wemos, but no device and no entities are visible in HassIO.

Do i need to add all the MQTT Subtopics as sensors to my configuration.yaml to get it work?

I don’t know what all these abbreviations for these attributes (Pf, Qf, Qr) mean under the /stromzaehler topic.

You will have to work with a value_template in an MQTT sensor to extract the info you need

- platform: mqtt
  name: "S31_01 Power"
  state_topic: "tele/S31_01/SENSOR"
  value_template: "{{ value_json['ENERGY'].Voltage}}"
  unit_of_measurement: "W"

from that:

But what you might be interested in could be under the subtopic 15m.