Ecowitt2mqtt: Send data from an Ecowitt device to MQTT

I think the DockerHub tags are out of sync, or maybe I don’t fully understand DockerHub. I noticed there have been two pushes somewhat recently for 2022.08.04 and 2022.08.05, but the latest tag was last updated when 2022.08.03 was pushed. I pull from the latest tag because it’s easier to update on my Synology that way. I suspect they are minor fixes, but I don’t like to get too far behind.

I ended up needing to retag 2022.08.5 to a new commit. latest should still have all the functionality of the latest release; are you seeing otherwise?

I downloaded from latest, reset the container, and then restarted it. The log says I’m still running 2022.08.03. I’m not having any problems, so it’s not like it’s huge issue, but it would be nice if latest got me to the current version at some point. Unless what you are saying is that functionally 2022.08.03 is the same as 2022.08.05. Then I really don’t mind.

There’s definitely a difference between the two. Not sure what happened there. I’ll keep an eye out for it the next time I cut a release.

1 Like

It looks like the latest tag on DockerHub is still behind. I see 2022.09.0 pushed two days ago, but latest is still showing it’s last push 23 days ago.

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