Ecowitt2mqtt: Send data from an Ecowitt device to MQTT

I was able to find the bug. It will be fixed in the next release. For now, use the 2022.09.0 or dev tags.

Excellent :slight_smile:

I don’t want it to be ‘discovered’, I just want to use the MQTT data (initially) so I how do I prevent it being discovered?

I’m unclear what you’re asking.

It looks like, by default, it is set up such that the sensors are discovered by HA. I don’t want this to happen - can I configure the ad-on, just to publish the sensor data to MQTT?

That isn’t currently possible – the whole purpose of the HASS add-on is to create entities from the data. Can you share what use case you’re wanting to achieve?

You could always disable the device that gets created…

1 Like

I’ve been using ecowitt2mqtt for while, thanks a lot for your work on it!

I tried to update to a later version today and noticed that the sensor ‘solarradiation_lux’ has been removed. I tracked this down to the update 2022.10.1 and a “Breaking change”. In your notes relating to this on Github you wrote:

“We previously always calculated solarradiation_lux if solarradiation was present. However, now that we have unit conversion, lux is merely an output unit option and shouldn’t be a separate sensor.”

I’ve tried read up on this but cannot find much sensible information other than complex papers on solar radiation. Does the deletion of this sensor mean that we can easily calculate the lux lx value from data already being provided via another sensor? If so, could you give me some pointers on how I can do that in HA?

Thanks very much for your reply!

Let me know if this solves your need: No longer getting lux value after upgrade · Issue #358 · bachya/ecowitt2mqtt · GitHub

Cristal clear now, thanks very much and sorry for not spotting it already in the instructions!

1 Like

Glad you’re all set!

@bachya: is it possible to disable the calculation of additional data on one specific gateway?
It seems my YAML doesn’t get recognised:

mqtt_broker: 192.168.x.y
mqtt_port: 8883
mqtt_tls: true
mqtt_username: xy
mqtt_password: xy
mqtt_retain: true
mqtt_topic: ecowitt
hass_discovery: false
output_unit_system: metric
precision: 2
verbose: false
gateways:
  9145DFC6:
    hass_discovery: false
    hass_discovery_prefix: homeassistant
    hass_entity_id_prefix: pws
    input_data_format: ecowitt
    input_unit_system: imperial
    mqtt_topic: ecowitt/pws
    output_unit_system: metric
    disable-calculated-data: true

The logs look as if the setting would be properly loaded within the gateway and in general the conversion remains enabled:
| DEBUG | Configs loaded: <Configs _configs={‘default’: {‘config’: ‘/ecowitt2mqtt/config.yaml’, ‘mqtt_broker’: ‘192.168.x.y’, ‘mqtt_port’: 8883, ‘mqtt_tls’: True, ‘mqtt_username’: ‘xy’, ‘mqtt_password’: ‘xy’, ‘mqtt_retain’: True, ‘mqtt_topic’: ‘ecowitt’, ‘hass_discovery’: False, ‘output_unit_system’: ‘metric’, ‘precision’: 2, ‘verbose’: True, ‘gateways’: {‘9145DFC6’: {‘hass_discovery’: False, ‘hass_discovery_prefix’: ‘homeassistant’, ‘hass_entity_id_prefix’: ‘pws’, ‘input_data_format’: ‘ecowitt’, ‘input_unit_system’: ‘imperial’, ‘mqtt_topic’: ‘ecowitt/pws’, ‘output_unit_system’: ‘metric’, ‘disable-calculated-data’: True}}, ‘endpoint’: ‘/data/report’, ‘input_unit_system’: ‘imperial’, ‘battery_override’: {}, ‘port’: 8080, ‘disable_calculated_data’: False, ‘default_battery_strategy’: <BatteryStrategy.BOOLEAN: ‘boolean’>, ‘raw_data’: False, ‘input_data_format’: <InputDataFormat.ECOWITT: ‘ecowitt’>, ‘diagnostics’: False}, ‘9145DFC6’: {‘config’: ‘/ecowitt2mqtt/config.yaml’, ‘mqtt_broker’: ‘192.168.x.y’, ‘mqtt_port’: 8883, ‘mqtt_tls’: True, ‘mqtt_username’: ‘xy’, ‘mqtt_password’: ‘xy’, ‘mqtt_retain’: True, ‘mqtt_topic’: ‘ecowitt/pws’, ‘hass_discovery’: False, ‘output_unit_system’: ‘metric’, ‘precision’: 2, ‘verbose’: True, ‘gateways’: {‘9145DFC6’: {‘hass_discovery’: False, ‘hass_discovery_prefix’: ‘homeassistant’, ‘hass_entity_id_prefix’: ‘pws’, ‘input_data_format’: ‘ecowitt’, ‘input_unit_system’: ‘imperial’, ‘mqtt_topic’: ‘ecowitt/pws’, ‘output_unit_system’: ‘metric’, ‘disable-calculated-data’: True}}, ‘hass_discovery_prefix’: ‘homeassistant’, ‘hass_entity_id_prefix’: ‘pws’, ‘input_data_format’: <InputDataFormat.ECOWITT: ‘ecowitt’>, ‘input_unit_system’: ‘imperial’, ‘disable-calculated-data’: True, ‘endpoint’: ‘/data/report’, ‘battery_override’: {}, ‘port’: 8080, ‘disable_calculated_data’: False, ‘default_battery_strategy’: <BatteryStrategy.BOOLEAN: ‘boolean’>, ‘raw_data’: False, ‘diagnostics’: False}}

How do I achieve this?

[Edit]
Even if I move the disable-calculated-data: true to the top (general section), the entries still get created.
The only workaround seems to be using the respective environment variable. But this removes all calculated data which is not my intention.

Instead of disable-calculated-data, you need disable_calculated_data (docs).

Well, that was mortifying. :flushed:
No case of RTFM, though - I’ve read it over and over. Maybe it’s time for a new pair of glasses…
Thank you for your patience (and ecowitt2mqtt, ofc)!

1 Like

No worries! :+1:t2:

Hi,

I wish to use ecowitt2mqtt to send my Ecowitt data through an MQTT channel.
Please note thant I have two instance of Home Assistant, and I also wish to share the data from my Ecowitt device to other servers through MQTT.

I’m under AlmaLinux. I’ve pulled the docker image bachya/ecowitt2mqtt:dev, and don’t understand why my configuration is failing.

Ecowitt GW1100A_V2.3.1 configuration: (static IP 192.168.1.6)
Weather Service:
Customized: Enable
Protocol Type Same As: Ecowitt
Server IP/ Hostname: 192.168.1.3
Path: /data/report
Port: 8080
Upload interval: 60

Mosquitto configuration:
mqtt://192.168.1.3:1883
Username: mqtt
Password: mqtt
Tested and fully functionnal (bridge for another broker, connection ok, tested with MQTT Explorer).

Docker configuration:

  ecowitt2mqtt:
    build:
      context: .
    container_name: ecowitt2mqtt
    image: bachya/ecowitt2mqtt:dev
    environment:
      ECOWITT2MQTT_ENDPOINT: /data/report
      ECOWITT2MQTT_INPUT_DATA_FORMAT: ecowitt
      ECOWITT2MQTT_INPUT_UNIT_SYSTEM: metric
      ECOWITT2MQTT_MQTT_BROKER: 192.168.1.3
      ECOWITT2MQTT_MQTT_PORT: 1883
      ECOWITT2MQTT_MQTT_USERNAME: mqtt
      ECOWITT2MQTT_MQTT_PASSWORD: mqtt
      ECOWITT2MQTT_MQTT_TOPIC: weather
      ECOWITT2MQTT_OUTPUT_UNIT_SYSTEM: metric
      ECOWITT2MQTT_OUTPUT_UNIT_TEMPERATURE: C
      ECOWITT2MQTT_VERBOSE: true      
    ports:
      - "8080:8080/tcp"
    restart: unless-stopped
    privileged: true

Firewall configuration:

$ firewall-cmd --zone=public --list-ports
1880/tcp 1883/tcp 8080/tcp 8086/tcp 8123/tcp 8888/tcp 9001/tcp

The docker console gives me this error message repeating forever:

  Value error, Invalid MQTT auth configuration [type=value_error, input_value={'mqtt_broker': 'mosquitt...min', 'verbose': 'true'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.6/v/value_error

as if the MQTT broker address/port/username/password were incorrect.

What am I doing wrong?
Thanks for your help.

Apologies for the delay! I’m not able to reproduce this. I used (nearly*) the same config:

services:
  ecowitt2mqtt:
    build:
      context: .
    container_name: ecowitt2mqtt
    environment:
      ECOWITT2MQTT_ENDPOINT: /data/report
      ECOWITT2MQTT_INPUT_DATA_FORMAT: ecowitt
      ECOWITT2MQTT_INPUT_UNIT_SYSTEM: metric
      ECOWITT2MQTT_MQTT_BROKER: 192.168.1.3
      ECOWITT2MQTT_MQTT_PORT: 1883
      ECOWITT2MQTT_MQTT_USERNAME: ecowitt
      ECOWITT2MQTT_MQTT_PASSWORD: password
      ECOWITT2MQTT_MQTT_TOPIC: weather
      ECOWITT2MQTT_OUTPUT_UNIT_SYSTEM: metric
      ECOWITT2MQTT_OUTPUT_UNIT_TEMPERATURE: °C
      ECOWITT2MQTT_VERBOSE: true   
    ports:
      - "8080:8080/tcp"
    restart: unless-stopped

…and everything started up fine:

ecowitt2mqtt  | 2024-03-19 22:24:57,397 | DEBUG | Input CLI options/environment variables: {'endpoint': '/data/report', 'input_data_format': 'ecowitt', 'input_unit_system': 'metric', 'mqtt_broker': '192.168.1.3', 'mqtt_password': 'password', 'mqtt_port': '1883', 'mqtt_topic': 'weather', 'mqtt_username': 'ecowitt', 'output_unit_system': 'metric', 'output_unit_temperature': '°C', 'verbose': 'true'}
ecowitt2mqtt  | 2024-03-19 22:24:57,397 | DEBUG | Configs loaded: <Configs _configs={'default': Config(mqtt_broker='192.168.1.3', mqtt_password='password', mqtt_port=1883, mqtt_retain=False, mqtt_tls=False, mqtt_topic='weather', mqtt_username='ecowitt', battery_overrides={}, boolean_battery_true_value=1, default_battery_strategy=<BatteryStrategy.BOOLEAN: 'boolean'>, disable_calculated_data=False, input_data_format=<InputDataFormat.ECOWITT: 'ecowitt'>, precision=None, raw_data=False, hass_discovery=False, hass_discovery_prefix='homeassistant', hass_entity_id_prefix=None, endpoint='/data/report', port=8080, diagnostics=False, verbose=True, output_unit_accumulated_precipitation=None, output_unit_distance=None, output_unit_humidity=None, output_unit_illuminance=None, output_unit_precipitation_rate=None, output_unit_pressure=None, output_unit_speed=None, output_unit_temperature=<UnitOfTemperature.CELSIUS: '°C'>, input_unit_system=<UnitSystem.METRIC: 'metric'>, output_unit_system=<UnitSystem.METRIC: 'metric'>, uuid='e5bb9761dcc04993a2228aaaabc19c51')}
ecowitt2mqtt  | 2024-03-19 22:24:57,399 | INFO | Starting ecowitt2mqtt (version 2024.01.2)
ecowitt2mqtt  | 2024-03-19 22:24:57,399 | DEBUG | Starting runtime

quick question. i have my mqtt broker in HA, and have created this docker image on my Synology NAS. I know in the config above I set my mqtt broker to the one on in HA, and then direct ecowitt to the docker custom server, but how do I set up a 2nd mqtt broker such that both my HA instances receive the ecowitt data?

Hi, I can’t get this addon to work.
Probably the connection between ecowitt2mqtt and mosquito broker is not working.
Any idea what I’m doing wrong?
Thank you
Snímek obrazovky 2024-10-17 153943
Log ecowitt2mqtt:

s6-rc: info: service legacy-services successfully started
[15:11:49] INFO: Fetching configuration...
[15:11:51] INFO: Using MQTT host: core-mosquitto
[15:11:51] INFO: Using MQTT port: 1883
[15:11:51] INFO: Using MQTT username: addons
[15:11:51] INFO: Using MQTT password: REDACTED
[15:11:55] INFO: Starting Ecowitt2MQTT
2024-10-17 15:11:57,981 | INFO | Starting ecowitt2mqtt (version 2024.10.0)

Log mosquitto broker:

2024-10-17 15:05:56: New client connected from 172.30.32.1:54591 as 7FQLnFCS5tM5LXIfFKsoLY (p2, c1, k60, u'mqtt_broker').
2024-10-17 15:07:47: New connection from 172.30.32.2:37950 on port 1883.
2024-10-17 15:07:47: Client <unknown> closed its connection.
2024-10-17 15:09:47: New connection from 172.30.32.2:48310 on port 1883.
2024-10-17 15:09:47: Client <unknown> closed its connection.
2024-10-17 15:11:47: New connection from 172.30.32.2:57494 on port 1883.
2024-10-17 15:11:47: Client <unknown> closed its connection.
2024-10-17 15:13:47: New connection from 172.30.32.2:53408 on port 1883.
2024-10-17 15:13:47: Client <unknown> closed its connection.

Continuing the discussion from Ecowitt2mqtt: Send data from an Ecowitt device to MQTT:

Cant seem to get this to work. It seems like the weather station is sending to the app but it doesn’t know what to do with it.

I get the following in the log:

2024-11-08 19:10:21,795 | DEBUG | Input CLI options/environment variables: {'diagnostics': 'true', 'input_data_format': 'ecowitt', 'mqtt_broker': 'mqtt', 'mqtt_port': '1883', 'mqtt_topic': 'Sensor/Weather/ObserverIP', 'verbose': 'true'}
2024-11-08 19:10:21,795 | DEBUG | Configs loaded: <Configs _configs={'default': Config(mqtt_broker='mqtt', mqtt_password=None, mqtt_port=1883, mqtt_retain=False, mqtt_tls=False, mqtt_topic='Sensor/Weather/ObserverIP', mqtt_username=None, battery_overrides={}, boolean_battery_true_value=1, default_battery_strategy=<BatteryStrategy.BOOLEAN: 'boolean'>, disable_calculated_data=False, input_data_format=<InputDataFormat.ECOWITT: 'ecowitt'>, precision=None, raw_data=False, hass_discovery=False, hass_discovery_prefix='homeassistant', hass_entity_id_prefix=None, endpoint='/data/report', port=8080, diagnostics=True, verbose=True, output_unit_accumulated_precipitation=None, output_unit_distance=None, output_unit_humidity=None, output_unit_illuminance=None, output_unit_precipitation_rate=None, output_unit_pressure=None, output_unit_speed=None, output_unit_temperature=None, input_unit_system=<UnitSystem.IMPERIAL: 'imperial'>, output_unit_system=<UnitSystem.IMPERIAL: 'imperial'>, uuid='ca63356cc173486eb4a6af4db9d20946', locale=None)}
2024-11-08 19:10:21,796 | INFO | Starting ecowitt2mqtt (version 2024.10.0)
2024-11-08 19:10:21,796 | DEBUG | Starting runtime
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO:     10.10.107.136:2744 - "GET /data/report/stationtype%3DAMBWeatherV4.3.5%26PASSKEY%3DDC%3A4F%3A22%3A5A%3ACA%3A01%26dateutc%3D2024-11-08%2B19%3A10%3A39%26tempinf%3D70.3%26battin%3D1%26humidityin%3D48%26baromrelin%3D29.197%26baromabsin%3D29.197%26tempf%3D68.4%26battout%3D1%26humidity%3D42%26winddir%3D335%26winddir_avg10m%3D328%26windspeedmph%3D0.9%26windspdmph_avg10m%3D1.1%26windgustmph%3D1.1%26maxdailygust%3D6.9%26hourlyrainin%3D0.000%26eventrainin%3D0.000%26dailyrainin%3D0.000%26weeklyrainin%3D0.000%26monthlyrainin%3D0.000%26yearlyrainin%3D37.720%26solarradiation%3D25.94%26uv%3D0%26batt_co2%3D1 HTTP/1.1" 404 Not Found

I run this in a docker container:

  mqtt:
    container_name: IoT_Mosquito
    image: eclipse-mosquitto:latest
    restart: unless-stopped
    environment:
      - TZ=America/Detroit
    ports:
      - "1883:1883"
    networks:
      - iot-net
    volumes:
      - mosquitto_data:/mosquitto/log:rw
      - mosquitto_data:/mosquitto/data:rw
      - mosquitto_data:/mosquitto/config:rw

  ambient_weather:
    container_name: IOT_AWN
    image: bachya/ecowitt2mqtt
    restart: unless-stopped
    depends_on:
      - mqtt
    environment:
      - ECOWITT2MQTT_MQTT_BROKER=mqtt
      - ECOWITT2MQTT_MQTT_PORT=1883
      - ECOWITT2MQTT_MQTT_TOPIC=Sensor/Weather/ObserverIP
      - ECOWITT2MQTT_DIAGNOSTICS=true
      - ECOWITT2MQTT_INPUT_DATA_FORMAT=ecowitt
      - ECOWITT2MQTT_VERBOSE=true
    ports:
      - '8080:8080'
    networks:
     - iot-net

The configuration app is:

Hello everyone!

First, a big thank you to @bachya for all the work on this integration—it’s much appreciated!

I’ve successfully set up the following:

  • An Ecowitt WS85 unit installed on my roof

  • An HP2561 console, currently on my desk but soon moving to the kitchen so the whole family can check it easily

  • An LXC container on my Proxmox server

  • A service running ecowitt2mqtt within that container

  • A configuration file to fine-tune all settings

Everything is running smoothly, but I have some questions regarding the pressure and temperature values.

On the HP2561 console, I’m seeing temperature, humidity, and pressure readings whose source is unclear to me. Is it possible that my console is picking up signals from a neighbor’s sensor? If so, is there a way to ignore these readings?

Thanks in advance for any insights!

Best regards,
Ignacio

Thanks for creating this integration!

I’m having trouble trying to figure out what hardware is required. I got my Dad an Ambient Weather WS-2000 last year and I’d like to hook it up to HA for him this year.

Do I just need to configure its console to send things in the right direction? Should I buy a GW2000 to receive the signal and send it to your integration? Do I need some sort of other bridge?

I see on GitHub - bachya/ecowitt2mqtt: Send data from Fine Offset weather stations (Ecowitt, Ambient Weather, Froggit, etc.) to MQTT! that you say to use an app to set it up, but I’m not sure if that app is for some particular piece of hardware and I’m not going to be at my parents place for a few weeks so I’d like to know what I should buy ahead of time.

Thanks!