Using the Ecowitt API to retrieve data from your Personal Weather Station (PWS)

Glad to hear you solved the important part! I of course stand by my backup suggestion even if you fixed it. :sweat_smile:
When I rebuilt my system I pulled files from my backup for reference. I’ve also reverted when I messed up the yaml. I see a lot of people not doing proper backups so I can’t say it enough.

There is the “Webpage Card”. It seems to work although I’m having a little trouble getingt the width the way I like.

EDIT: It’s acting strange on my Android device. That might be because I clicked the auto login box.

So I found out why nothing works once I tried ecowitt2mqtt. It logs what is received and my ecowitt is not sending it anything! I did see it sending data once but I can’treimplement it. Very odd. I’ll look to see if there is a firmware upgrade.

1 Like

Hello Rod,

I have a front end that I wrote that runs on Java. It is basically a bunch of jPanels on the screen that I can populate with any number of items. One of the jPanels currently connects to and interrogates the NASA DONKI space weather database every 60 seconds and receives a JSON file, then it parses it and I can see where the last solar flare was.

I am currently writing a Java class to do basically the same thing with the Ecowitt API.

However, I would much rather read the data directly from the Ecowitt RF/Ethernet interface, so I am not reliant on the Ecowitt server as middleware.

It also runs on a Raspberry Pi, with a 7" display, if you want it to, and encodes an RS232 serial data stream that emulates a Peet Brothers weather station. I am using that to feed a Byonics TinyTrack 4 APRS modem.

But a 7" display can’t show that much. So it also runs on any PC, Mac or Linux box, or really anything that you can install the Java runtime environment on.

I also have utility class that I wrote in straight Java that directly reads a Bosch BME280 sensor, and a Honeywell MPRLS sensor, as well as the DHT sensor. that read temperature, humidity and air pressure. And also a Network time jPanel class and a compass rose & wind direction jPanel class.

Basically, the Ecowitt unit is just another sensor platform that I will be writing an interface to, and it will be displayed on a jPanel, that you can put on anything you like.

So let me know if this is of interest and I will make a GIT project out of it and share it.

Also, if you have any information on how to read data directly off the Ecowitt local receiver Ethernet interface, that would be most appreciated. That way I can avoid the internet for reading the Ecowitt.

Kind regards and Merry Christmas,
John

1 Like

If you add the following sequence to the htpp call you should get metric results:

&wind_speed_unitid=7&temp_unitid=1&pressure_unitid=3&rainfall_unitid=12

I have it like that in a php script I use in eedomus, I just migrated from eedomus to HA and this is one of the last things to do.

I don’t want to use the ecowitt integration because I’m using the custom server from my ecowitt to send data to another server, and it just can be one as far as I know.

I’ll look into your code to see how I can implement it.

Thanks!

You could always have HA relay the data to the other server if you wanted.

Hi Rod, Thanks for your code in the first post. I’m not quite sure what to do with it though! I tried putting in in config.yaml file, is this right?

Yes it works for me in conficuration.yaml. check your file name as it looks wrong.

Thanks @rodw. It is a very easy way to integrate the weather station into home assistant. Works great!

Also thanks to @ardeban for the conversion to metric directly from the URL.

I recommend reading the ecowitt api documentation as it is very helpful.

@bigdogevan: If you don’nt know where to put Rod’s code, it must be placed under “sensors” in your configuration.yaml file:

sensors:
#-----Ecowitt PWS via their API-----
  - platform: rest
    name: pws
    json_attributes:
      - code
      - data
      - msg
      - time
    resource: https://api.ecowitt.net/api/v3/device/real_time?application_key=XXXXXX&api_key=YYYYY&mac=AA:BB:CC:DD:EE:FF&call_back=all
    #scan_interval: 10
    method: GET
...

You have it working? Because from my experience the integration CREATES the webhook. And the documentation from the integration itself shows details on using the webhook AND the HA port 8123.

Thank you @rodw !

I already had a local ecowitt integration working using MQTT, but I needed to get data from another weather station located in a house without a way to run Home Assistant. The API works REST call works!

Sorry for the late reply. The HACS version got busted but the built in version works.

I left it configured for a LOOOOOONG time before it started working, don’t know why.

@giqcass How do I do this (Relay to another server) ?
Since I want the data direct to HA and to www.awekas.at (at the moment I’m using a similar REST polling like its shown in this post)

You would want to use an automation to trigger a “RESTful Command”. If you are using NodeRed that would be another option.

Units can be changed with the parameters:

&temp_unitid=1&pressure_unitid=3&wind_speed_unitid=7&rainfall_unitid=12

works fine for me!

Tom

Hello ,can you tell me the ecowitt device send data to HA communication protocol is used HTTP GET or MQTT and can provide API example for me ,I want to know the complete API string is http://host IP:8123/api/webhook/ecowitt integestion genrate key/stationtype=GW2000A-WiFi8047V3.0.7/dateutc=2024-1-24+20:00:00&tempinf=10.0 is correct or not ?Thank uou