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

You don’t need to create a webhook to use the integration and you use the port the integration exposes instead of the HA port. I believe the port is always 4199 by default. We must be using different integrations or different versions.

hmm,
there is something going on. This is what I get when installing the integration after a reboot

I can’t see there is anything to uninstall from the past. I dug around some folders
Using 2022.9.1 cos I get an error if I update but thats another story
2022-09-27 19:44:58.491 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547269756480] Error updating Home Assistant Core 'HomeAssistantCore.update' blocked from execution, system is not healthy

SO I tried using the different settings from the screendump above. The integration failed with an error.
In the log I get.

2022-09-27 19:36:26.017 INFO (SyncWorker_1) [homeassistant.loader] Loaded ecowitt from homeassistant.components.ecowitt
2022-09-27 19:38:13.292 INFO (MainThread) [homeassistant.setup] Setting up ecowitt
2022-09-27 19:38:13.293 INFO (MainThread) [homeassistant.setup] Setup of domain ecowitt took 0.0 seconds
2022-09-27 19:38:13.299 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.ecowitt
2022-09-27 19:38:13.302 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ecowitt
2022-09-27 19:51:47.664 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.ecowitt
2022-09-27 19:51:47.666 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ecowitt
2022-09-27 19:51:47.670 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Ecowitt for ecowitt
File "/usr/src/homeassistant/homeassistant/components/ecowitt/__init__.py", line 29, in async_setup_entry

Any ideas? I am quite a noob so don’t really know how to clean up errors.

1 Like

That line just points to code that tries to register the new webhook internally, which then apparently fails without giving any reason.
Are there any other error messages in your log, maybe related to setting up webhooks?

1 Like

yeh I saw that. I can’t access that folder.
When I walk the folders one by one, this one is not found in the terminal
/usr/src/homeassistant

I must need root access and I can’t use sudo or su either.

This is where we have to ask questions like how you have HA installed.

Tell us how you installed Home Assistant

Tell us if you’re running Hass.io 199 using an official HassOS image, a Docker install, Hassbian, a venv install, and so on. Things that are often really useful to know include:

What version number of Home Assistant are you running?
How you installed it. If you’re not using Hassbian or a HassOS based 

Hass.io 199 install, remember to tell us the operating system
Any relevant code - correctly formatted

For example:

Home Assistant 0.42.0 using Hass.io 199 with the HassOS image
Home Assistant 0.84.2 in a venv following this guide 13 on Windows 10
Home Assistant 0.90.2 using Hass.io 199 on Ubuntu 18.04 following this guide 23

Please remember that words like latest, current, newest and so on are not version numbers.

Thanks, I’m using the raspberry pi (4b) version of the Home assistant OS.
Version is 2022.9.1
I am stuck there and can’t upgrade further becasue of

[547453715456] Error updating Home Assistant Core 'HomeAssistantCore.update' blocked from execution, system is not healthy
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hassio/update.py", line 299, in async_install
    await async_update_core(self.hass, version=version, backup=backup)
  File "/usr/src/homeassistant/homeassistant/components/hassio/handler.py", line 45, in _wrapper
    raise HassioAPIError(data["message"])
homeassistant.components.hassio.handler.HassioAPIError: 'HomeAssistantCore.update' blocked from execution, system is not healthy

Seems to be trying to access the same folder

1 Like

Assuming you didn’t change anything in the file system yourself I can’t help but wonder if this is an issue created by failing storage. Are you using an SD card? SD cards give a poorer user experience. I use an inexpensive SSD and a SATA adapter on most of my full size PI boards.

I would definitely make sure I created a backup. Save that backup and a couple of the earlier backups on a different device if you haven’t done so. I make sure the file size matches when manually downloading a backup. You can also open the backup with WinRAR, Winzip, or whatever you like to verify you downloaded the whole file. It may sound paranoid but I have had issues with partial downloads using the manual backup download interface.

hassip:8123//hassio/backups or Settings >> System >> Backups

Then I would consider creating a fresh install on a different storage device if possible. Use the backup to do a restore. I suspect that would eliminate the errors.

Thanks, I doubt its a hardware issue. I solved my upgrade issue

so am now finally running 2022.9.7.
I went and had a look at HACS and deleted a ecowitt repo there, restarted and tried again.
It still showed me webhook info which I entered on the phone app.
Nothing works.
There are a number of people with the same problem on the ecowitt github issues.
I think I will call it a day.
I might try mqtt one day but its not a high priority.

1 Like

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!