Tasmota MQTT Feed

HI

1st post and a newbie when it comes to coding…
I just got 4 smart plugs and converted them to Tasmota and would like to get MQTT to work via emonpi with PV.
They connect and send data but I cant fine one bit of information on how to add them or similar to emonpi. Plugs work great on Home Assistant and was easy to setup.

What am i missing? been 2day at it :slight_smile: with no luck

What do you mean by this? Are you trying to record data?

Morning

Sorry if I wasn’t clear. I have emonpi pv was what I meant to say, want to add the tasmota flashed smart plug to emonscm via mqtt mostly to monitor energy usage of the plug and if possible control.

Chris

You can’t really “add the plugs to emoncms” but you can get Home Assistant to send the readings.

Note - you need to calibrate these devices as they are very inaccurate otherwise.

In HA you will see these sensors assuming the plugs you have do export power usage (not all do).

Have you installed an MQTT Broker in HA? If not - don’t and follow this. If you have installed a broker, then it’ll need a bit more fiddling.

I think probably the easiest way is to point HA to the MQTT broker on your EmonPi and use the mqtt_statestream component.

In your HA configuration.yaml put this;

mqtt:
  broker: <emonpi IP>
  client_id: HAMainPi
  username: emonpi
  password: emonpimqtt2016
  discovery: false

mqtt_statestream:
  base_topic: emon
  include: 
    entities:
      - sensor.your_sensor_name

The values will just appear in your Inputs one Emoncms.

That is great thanks, I’ll let you know how it turns out,
the plugs do power reading and has been calibrated so thanks for that aswell.

Currently have HA also as MQTT broker but will follow your advice.

I would suggest if not already make a how to section on your site I’ll do a how to when I have it all working.

My end goal will be to have HA on emonpi and just have one server to do it all.

Thanks again

Chris

The simplest way is to Bridge the 2 brokers together. Mosquitto MQTT Bridge-Usage and Configuration is a good guide

Create a file /etc/mosquitto/conf.d/bridge.conf and use a version of…

connection bridge-prox
address <HA IP>:1883
remote_username UNAME
remote_password PASSWD

topic # out 0
topic # in 0

What you need/want depends on your setup.

Anything published on the HA Broker will get mirrored onto the emonpi broker (I mirror both ways).

Not a good idea. HA is vey bad for SD Card wear - Emoncms is optimised to preserve SD Cards. Keep them separate.

Thanks for the info, got it all working I can see the plugs feeds now under sensors. the do go orange regularly why is that?

I will read up and see what i can fine, but how do i create APPs, the basic app only give one reading i would like to have similar view as solar app.

Chris