MQTT Config for ecowitt2mqtt stream

I am down to the sensor configuration and lost in this.

Working

  • ecowitt2mqtt pythonscript is receiving the GW stream
  • MQTT Broker is receiving the ecowitt2mqtt topic (mine is ‘ecowitt2mqtt/device_1’)
  • Home Assistant MQTT integration (configuration.yaml MQTT) can listen to the topic above and sees the data.

Data

from the ‘Listen to a topic’

 Message 0 received on ecowitt2mqtt/device_1 at 3:52 PM:

{
    "tempin": 76.6,
    "humidityin": 52,
    "baromrel": 29.2,
    "baromabs": 29.2,
    "temp": 92.7,
    "humidity": 46,
    "winddir": 33,
    "windspeed": 3.1,
    "windgust": 4.9,
    "maxdailygust": 9.4,
    "solarradiation": 601.9,
    "uv": 5,
    "rainrate": 0,
    "eventrain": 0,
    "hourlyrain": 0,
    "dailyrain": 0,
    "weeklyrain": 0,
    "monthlyrain": 2,
    "yearlyrain": 2,
    "totalrain": 2,
    "temp1": 90.1,
    "humidity1": 49,
    "temp3": 81,
    "humidity3": 47,
    "temp4": -0.2,
    "humidity4": 62,
    "temp5": 74.7,
    "humidity5": 52,
    "soilmoisture1": 13,
    "lightning_time": "",
    "lightning_num": 0,
    "lightning": "",
    "leak_ch1": 0,
    "wh80batt": "on",
    "batt1": "off",
    "batt3": "off",
    "batt4": "off",
    "batt5": "off",
    "soilbatt1": "on",
    "wh57batt": "on",
    "leakbatt1": "on",
    "dewpoint": 68.9,
    "feelslike": 97.8,
    "heatindex": 97.8,
    "solarradiation_lux": 76189.9,
    "solarradiation_perceived": 98,
    "windchill": null
}

Question

How do I configure to pull the data into an entity

current configs

sensor.yaml

# MQTT settings
- platform: mqtt
  state_topic: 'ecowitt2mqtt/device_1/temp'
  name: 'temp_BY'
  unit_of_measurement: '°F'

Note I also tried 'ecowitt2mqtt/device_1

Configuration.yaml

I assume this is working as I can listen to the topic

mqtt:
  broker: 10.10.10.11
  username: mqtt
  password: mqtt
  port: 1883
  discovery: true

Have you considered using the HACS add-on? I haven’t got an Ecowitt weather station myself (yet), but was hopeful that this add-on bridges the gap.

Thank You - I have that installed and it does work. The limitation is no Lightning reporting.

Though learning is an adventure for me, and having the MQTT Knowledge gap, does drive me to play with it, the root of the project is

EcoWitt detects lightning → send to HASS → HASS triggers event to LaMetric Clock → Clock displays how far the strike was.

So lightning, and the first thing that enters everyone’s mind, “how far was that” will be displayed on the digital clock.

Ambient (the equipment is their brand) reports it to the WEB, but not through their API to HASS, The plug in does not have it (never looked at the code to see if I could add it).

I am getting there, will post more details but, this did read the stream.

# MQTT settings
- platform: mqtt
  name: "BackYard_Solar_Radiation"
  state_topic: "ecowitt2mqtt/device_1"
  unit_of_measurement: "Lux"
  value_template: "{{ value_json.solarradiation_lux }}"

Net of it is

  • the data is in JSON
  • name can be what ever you want your new entity to be
  • then the value_template is the JSON format to pull the variable out
INFO:ecowitt2mqtt:Published to ecowitt2mqtt/device_1: {'tempin': 77.5, 'humidityin': 53.0, 'baromrel': 29.4, 'baromabs': 29.4, 'temp': 74.1, 'humidity': 88.0, 'winddir': 81.0, 'windspeed': 0.0, 'windgust': 0.0, 'maxdailygust': 7.8, 'solarradiation': 58.7, 'uv': 0.0, 'rainrate': 0.0, 'eventrain': 0.0, 'hourlyrain': 0.0, 'dailyrain': 0.0, 'weeklyrain': 0.0, 'monthlyrain': 2.0, 'yearlyrain': 2.0, 'totalrain': 2.0, 'temp1': 76.1, 'humidity1': 80.0, 'temp3': 75.4, 'humidity3': 56.0, 'temp4': -9.6, 'humidity4': 66.0, 'temp5': 76.3, 'humidity5': 55.0, 'soilmoisture1': 10.0, 'lightning_time': '', 'lightning_num': 0.0, 'lightning': '', 'leak_ch1': 0.0, 'wh80batt': 'on', 'batt1': 'off', 'batt3': 'off', 'batt4': 'off', 'batt5': 'off', 'soilbatt1': 'on', 'wh57batt': 'on', 'leakbatt1': 'on', 'dewpoint': 70.3, 'feelslike': 74.1, 'heatindex': 75.3, 'solarradiation_lux': 7430.4, 'solarradiation_perceived': 77.0, 'windchill': None}

For those like me that are in the learning bucket. JSON has variable: value pairs so in the above

‘solarradiation_lux’: 7430.4,

I am using ‘solarradiation_lux’ in the value_template to find what to put into the entity “BackYard_Solar_Radiation”

I will be repeating this for the data that is in the full JSON Stream, for me the big ones are

'lightning_time': '', 'lightning_num': 0.0, 'lightning': ''
1 Like