Ecowitt2mqtt: Send data from an Ecowitt device to MQTT

I got python3 loaded on my windows machine. I was thinking that I would use samba to write it to the machine that I run home assistant on. It’s running home assistant os…that sounds like a deal breaker, is that right?
https://www.home-assistant.io/blue/

I do have a synology nas that I could maybe put it on. Would that work? It’s also on 24/7.

Correct: running this on the new Home Assistant Blue is not supported. The Synology should work great and @nickrout gave an idea for the Blue below.

So then, do I try to execute the pip command on the synology somewhere? Have you done that, or are you familiar with what approach is needed?

Yes it will run on the blue.

Install the portainer addon, then install the docker implementation.

1 Like

OK, that helps. Glad to know it will run on Blue. I’ll install portainer and then what, use docker to install it? The install command of pip is issued thru docker? Sorry to be so dumb here, but I am quite the noob, but I am learning.

Actually you could install web terminal and ssh addon and simply run the docker comand in the docs.

1 Like

So, I researched what a portainer is, and loaded it on my Home Assistant. Then, I ran the docker command in a new container and loaded ecowitt2mqtt. I loaded mosquitto MQTT broker on my machine and made a new non-admin user for it with the name “skeeter”. I think that I got the MQTT broker set up ok. I also set up the ecowitt phone app as described to send data to the HA URL, for me its 10.0.0.186.

Now, I am trying to determine what to do with this bit :

$ ecowitt2mqtt
–mqtt-broker=10.0.0.186
–mqtt-username=skeeter
–mqtt-password=
–mqtt-topic=ecowitt2mqtt/device_1

I have an SSH terminal with the “$” command prompt, but don’t know what to do next ? The terminal is running on my home assistant computer, thru an add on called “terminal and SSH”.

Stuck here, what to do ?

Perhaps I need to edit the YAML file to input these environment variables ? That’s my current best guess. I will poke around tonight and hopefully not break anything.

When I run the ecowitt2MQTT in portainer, I get an error message in the logs that reads “Missing required environment variable: MQTT_BROKER”.

I know that I need to set this, but I don’t know where or how to do it. I downloaded the file editor but I cannot find the correct file that I might edit.

Rather than dealing with all this: just today, I collaborated with another user to create a Home Assistant add-on that you can install via the Home Assistant UI.

You’ll need to add a new repo (instructions here), then add this repo: https://github.com/smarthall/hassio-addons

4 Likes

Thanks, I’ll for sure check it out. For me, it was here: as add a repository.

Success !!!

image|690x286

You might want to revisit the portion of your instructions where you suggest setting the port to 8000, or whatever you like, as I originally had it at 8080 for some reason and would not know how to change it currently. I set it to 8000 (probably matching the config) and it started working. Hooray! Great work.

This is a great piece of work - I have an Ecowitt HP2551 now talking to my new HA setup.

Thank you.

1 Like

Thank you Aaron, great work! I now have my Ambient PWS and one additional temp/hum sensor reporting locally to HA running in a VM on an UnRAID server. I installed the ecowitt2mqtt server on a Raspberry Pi 3B with the Ecowitt GW1000 plugged into the Pi that is closer to my PWS than my UnRAID server.

1 Like

Hi, I have followed Supervisor instructions in my HASSIO 2021.3.3 but I obtain only this:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:40:43] INFO: Fetching configuration...
[09:40:46] INFO: Starting Ecowitt2MQTT
INFO:aiohttp.access:192.168.0.10 [20/Mar/2021:09:41:04 +0000] "POST /data/report/ HTTP/1.1" 404 197 "-" "-"
INFO:aiohttp.access:192.168.0.10 [20/Mar/2021:09:41:32 +0000] "POST /data/report/ HTTP/1.1" 404 197 "-" "-"
INFO:aiohttp.access:192.168.0.10 [20/Mar/2021:09:42:08 +0000] "POST /data/report/ HTTP/1.1" 404 197 "-" "-"
INFO:aiohttp.access:192.168.0.10 [20/Mar/2021:09:42:32 +0000] "POST /data/report/ HTTP/1.1" 404 197 "-" "-"
INFO:aiohttp.access:192.168.0.10 [20/Mar/2021:09:42:56 +0000] "POST /data/report/ HTTP/1.1" 404 197 "-" "-"

May be that my Sainlogic WS3500 is not compliant to Ecowitt protocol or may be that supervisor integration for my HASSIO is not working?

Where may I change parameters, rather than only "unit_system"?

`Thank you’

Hi All,

Installed the GW1000 and sensors today, all working in the WS app, but hitting the wall with the final piece of the puzzle, and thats getting it all into HA.

So - HA is on a VM on the QNAP NAS. Both OS and Version are current. MQTT Broker is on docker in the NAS. Everythign else is still working fine.

Ive installed the Ecowitt2MQTT, and once started, here are the logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:44:35] INFO: Fetching configuration...
[21:44:35] ERROR: Got unexpected response from the API: Service not enabled
[21:44:35] INFO: Starting Ecowitt2MQTT
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.8/site-packages/ecowitt2mqtt/mqtt.py", line 114, in async_publish_payload
    await _async_publish_to_hass_discovery(client, data, discovery_manager)
  File "/usr/lib/python3.8/site-packages/ecowitt2mqtt/mqtt.py", line 32, in _async_publish_to_hass_discovery
    async with client:
  File "/usr/lib/python3.8/site-packages/asyncio_mqtt/client.py", line 315, in __aenter__
    await self.connect()
  File "/usr/lib/python3.8/site-packages/asyncio_mqtt/client.py", line 78, in connect
    self._client.connect(self._hostname, self._port, 60)
  File "/usr/lib/python3.8/site-packages/paho/mqtt/client.py", line 939, in connect
    self.connect_async(host, port, keepalive,
  File "/usr/lib/python3.8/site-packages/paho/mqtt/client.py", line 1005, in connect_async
    raise ValueError('Invalid host.')
ValueError: Invalid host.
INFO:aiohttp.access:10.1.1.205 [28/Mar/2021:10:44:37 +0000] "POST /data/report HTTP/1.1" 500 250 "-" "-"

Any ideas?

Thanks,

JOK

Your error says ValueError: Invalid host. – sounds like ecowitt2mqtt can’t reach your HASS machine.

Thanks Aaron,

Thats kind of what I thought.

I tried different IP address ( that of the HA VM - .171, and that of the host QNAP - .165, ) with no success.

Do I need to add the MQTT broker IP, U/N and P/W at all?

Thanks again.

Jarrod.

Correct, ecowitt2mqtt talks to your MQTT broker, so you will need to provide its IP/user/pass.

Thansk again Aaron,

so one last question if I may - where do I enter the broker credentails? - my MQTT broker is external to HA, running in a docker containmer on the NAS. - and therefore not ( I dont think ) on the HA auto discovery. - Is this a mandatory ( MQTT Discovery ) for Ecowitt2Mqtt?

Thanks,

Jarrod.