Author Topic: Ecowitt.net API release  (Read 13756 times)

0 Members and 1 Guest are viewing this topic.

Offline waiukuweather

  • Forecaster
  • *****
  • Posts: 1073
Re: Ecowitt.net API release
« Reply #75 on: January 29, 2022, 12:40:40 AM »
completed history data integration
was a fun challenge :)

Offline fra

  • Member
  • *
  • Posts: 7
Re: Ecowitt.net API release
« Reply #76 on: February 09, 2022, 01:46:35 PM »
I'm testing it and I'm feeding data to PWSDashboard. So far it seems to be working properly, no outages

Offline waiukuweather

  • Forecaster
  • *****
  • Posts: 1073
Re: Ecowitt.net API release
« Reply #77 on: February 10, 2022, 02:19:28 PM »
i had to rewrite my code to fix a memory leak with the json handling
I see one problem with raw data..the rain is in inches,but there is not much precision, i.e converting to mm, there is lost accuracy/precision

Offline mihec

  • Member
  • *
  • Posts: 38
Re: Ecowitt.net API release
« Reply #78 on: May 12, 2022, 12:15:58 AM »
I'm not sure if this is the right place to ask.
I currently have the Froggit DP1500 (Ecowitt smart hub) and a soil moisture sensor. Weather Display connects to the hub directly and collects the data into WD's logfiles.
In parallel, I run a python script which connects to the Ecowitt cloud and requests the same data (I log into my log files). This works with no issues.

I'm going to purchase the set of Froggit DP1500 and wireless anemometer and install at remote location. I intend to set the DP1500 to send data to the Ecowitt cloud. I would then read wind data from the cloud at my home location. As far as I read, the anemometer updates the wind values in 16.5 second interval. My question is, can I send read requests to the Ecowitt every 16.5 second and get valid response? Or, is data in the Ecowitt cloud somehow post processed for 1-minute intervals (e.g. average speed, max gust)?

Thanks!

Offline broadstairs

  • Forecaster
  • *****
  • Posts: 960
Re: Ecowitt.net API release
« Reply #79 on: May 12, 2022, 04:55:38 AM »
As I understand it the Ecowitt api provides data every 5 minutes which in my view is not ideal but it is what it is!

Stuart
Ecowitt GW1003 with ultrasonic wind gauge, lightning sensor and PM2.5 sensor with Personal Weather Tablet as a console.

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1213
    • Wilmslow Astro
Re: Ecowitt.net API release
« Reply #80 on: May 12, 2022, 06:50:09 AM »
The historic data is every 5 mins (for 6 mths?), but current data is updated once a minute.
Mark

Offline broadstairs

  • Forecaster
  • *****
  • Posts: 960
Re: Ecowitt.net API release
« Reply #81 on: May 12, 2022, 06:57:23 AM »
The historic data is every 5 mins (for 6 mths?), but current data is updated once a minute.

Is there a way to obtain data to 1 minute resolution from Ecowitt other than screen scraping? The API and export of data only provide 5 minute resolution.

Stuart
Ecowitt GW1003 with ultrasonic wind gauge, lightning sensor and PM2.5 sensor with Personal Weather Tablet as a console.

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3932
Re: Ecowitt.net API release
« Reply #82 on: May 12, 2022, 09:11:24 AM »
The historic data is every 5 mins (for 6 mths?), but current data is updated once a minute.

Is there a way to obtain data to 1 minute resolution from Ecowitt other than screen scraping? The API and export of data only provide 5 minute resolution.

Stuart
Good question - would be interesting to hear Ecowitt's answer ...
However I think that beyond deisplaying the current minute based data they are doing a loop processing with the one minute data and save/archive every five minutes.
What their accumulators look like would also be interesting, meaning which would be the value archived: min, max, avg, last - and also if that's the same for every observation type or different.
« Last Edit: May 12, 2022, 09:13:23 AM by Gyvate »
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.4, GW1200 1.3.2, GW2000(3) 3.1.5, HP2551 1.9.7,5.1.6;HP3500 1.7.2,WS3800 1.3.0, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.4.3/1.4.0, WS80(2)1.2.8, WS68, WS69, WH40,WH31,WH31-EP,WN30,WN34L,WN35,WH32,WH32-EP, WH32B, WH57 [Lightning], WH41[PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB,MB VM
Barani Meteoshield Pro, MetSpecRad02
weather landing page: http://meshka.eu
WIKI https://meshka.eu/Ecowitt/dokuwiki

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1213
    • Wilmslow Astro
Re: Ecowitt.net API release
« Reply #83 on: May 12, 2022, 11:11:14 AM »
Is there a way to obtain data to 1 minute resolution from Ecowitt other than screen scraping? The API and export of data only provide 5 minute resolution.

Stuart
?? The API does provide 1 minute current data.
Mark

Offline mihec

  • Member
  • *
  • Posts: 38
Re: Ecowitt.net API release
« Reply #84 on: May 14, 2022, 02:52:51 AM »
I'm still waiting for the hardware but just for clarification: the hub will send wind updates to Ecowitt every 16.5 seconds and this data will then be processed on the Ecowitt's side to provide 1-minute: average speed, max gust, current/avg direction ? I hope my understanding is right. Thanks.

Offline olicat

  • Forecaster
  • *****
  • Posts: 1615
  • GWxx00, HPx5x1C, WN1900C, WN1980C & WS3xx0C
    • FOSHKplugin
Re: Ecowitt.net API release
« Reply #85 on: May 14, 2022, 03:25:05 AM »
Hi!

Quote
the hub will send wind updates to Ecowitt every 16.5 seconds and this data will then be processed on the Ecowitt's side to provide 1-minute: average speed, max gust, current/avg direction ?
No.

There are several intervals:

Sensor --> Console
This interval depends on the specific sensor and is fixed. Some sensors send the data every approx. 5 seconds (4.8 sec = WS80), others at 16 second intervals (WH65) or every 8.8 seconds (WS90).
see https://www.wxforum.net/index.php?topic=40730.msg446458#msg446458

Console --> Weather Service Ecowitt.net
This interval is user configurable and is either 1, 2, 3, 4 or 5 minutes. However, the average value of the values accumulated in the sensor transmission interval is not currently sent (with existing firmware), but only the last value received from each sensor.

The procedure for forming the 5-minute interval at Ecowitt.net is not published - at least I do not know how this value is formed. Of course, we assume an average value calculation. But that is what one would expect when sending to the weather services - and that is (unfortunately) not done there.

For other services, a shorter transmission interval can be configured. This means that the custom server can actually send the most recently received sensor values every 16 seconds. With additional tools (such as FOSHKplugin), this interval can also be reduced to 1 second. However, this generates considerable traffic and CPU load and - because the sensors so often do not send any new data - does not make much sense.

The formation of averages for sending to weather services has been a wish expressed by users for a long time. So far, however, we have not been listened to. Admittedly, this is quite complex and probably not all consoles have the corresponding resources (CPU, RAM). However, with new devices like the GW2000 and the improved hardware equipment, this should become possible.

Regards, Oliver

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1213
    • Wilmslow Astro
Re: Ecowitt.net API release
« Reply #86 on: May 14, 2022, 06:00:09 AM »
The procedure for forming the 5-minute interval at Ecowitt.net is not published - at least I do not know how this value is formed. Of course, we assume an average value calculation. But that is what one would expect when sending to the weather services - and that is (unfortunately) not done there.
The solar (haven't checked UV, but I assume that also), and gust values are the max values in the period, the rest (of the core readings wind speed/T/H/P, haven't checked any additional sensors) are averages.
Mark

Offline mihec

  • Member
  • *
  • Posts: 38
Re: Ecowitt.net API release
« Reply #87 on: May 17, 2022, 01:12:28 AM »
I have the system up an confirm the values in the Ecowitt's cloud update every minute with:
* average wind in the last minute
* maximum gust in the last minute

I did not pay attention to UV and solar but I assume the raw reading is done once per minute and as such reported to the cloud.

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1213
    • Wilmslow Astro
Re: Ecowitt.net API release
« Reply #88 on: May 17, 2022, 04:17:11 AM »
I did not pay attention to UV and solar but I assume the raw reading is done once per minute and as such reported to the cloud.
With the WS80 at least, the solar and UV values change with every sensor update - 4.75 seconds. I'm not sure what gets sent to the cloud, but the cloud uses the max of the 1 minute values in it's 5 minute roll-up.
Mark

Offline olicat

  • Forecaster
  • *****
  • Posts: 1615
  • GWxx00, HPx5x1C, WN1900C, WN1980C & WS3xx0C
    • FOSHKplugin
Re: Ecowitt.net API release
« Reply #89 on: January 10, 2023, 02:06:48 AM »
Hi!

To bring this interesting function back into focus ...
The Ecowitt.net API received another update at the end of December. Now the images submitted by the HP10 can also be retrieved:

Code: [Select]
#! /usr/bin/python3
# test the Ecowitt.net-API v3 functionality
import requests
import json

# user settings
APIKey = ""                                                    # your API key
APPKey = ""                                                    # your APP key
MACAddr = ""                                                   # MAC address of HP10 camera "AA:BB:CC:DD:EE:FF"

# Ecowitt-settings
APIURL = "https://api.ecowitt.net/api/v3/device/"
httpTimeOut = 10

def getFromEcowitt(url):
  ret = ""
  try:
    headers = {'Connection': 'Close','User-Agent': None}
    r = requests.get(url,timeout=httpTimeOut)
    ret = r.text.strip()
  except requests.exceptions.Timeout as err:
    ret = "TIMEOUT"
  except requests.exceptions.ConnectionError as err:
    ret = "CONNERR"
  except requests.exceptions.RequestException as err:
    ret = "REQERR"
  return ret

# camera
call_back = "camera.photo"
jdata = json.loads(getFromEcowitt(APIURL+"real_time?application_key="+APPKey+"&api_key="+APIKey+"&mac="+MACAddr+"&call_back="+call_back))
print()
print("json: "+str(jdata))
print("code: "+str(jdata["code"]))
print("msg:  "+str(jdata["msg"]))
print("time: "+str(jdata["time"]))
print("url:  "+str(jdata["data"]["camera"]["photo"]["url"]))

See API documentation.

Oliver

Offline waiukuweather

  • Forecaster
  • *****
  • Posts: 1073
Re: Ecowitt.net API release
« Reply #90 on: January 11, 2023, 05:46:24 PM »
this is now working in weather display software
(see the WD Facebook ) :)

Offline wardie

  • Senior Contributor
  • ****
  • Posts: 212
Re: Ecowitt.net API release
« Reply #91 on: January 12, 2023, 04:46:37 PM »
I did not pay attention to UV and solar but I assume the raw reading is done once per minute and as such reported to the cloud.
With the WS80 at least, the solar and UV values change with every sensor update - 4.75 seconds. I'm not sure what gets sent to the cloud, but the cloud uses the max of the 1 minute values in it's 5 minute roll-up.
From my prior conversations, I believe that the server upload just uses the last reported sensor values - at least for wind. So in theory it could miss some peaks. It was a while back I did the analysis (2020) but I managed to demonstrate this was right then, comparing the ecowitt server collected data versus the data I locally accumulated in weewx via FOSHKplugin. The whew will aggregate data into 5 minute periods based on the maximum reported - with the WS80 feeding in all sensor updates in, and I could see discrepencies between that and the ecowitt cloud data.
Froggit HP1000SE Pro-C console (HP2551-C)
Froggit HP1000SE Pro ultrasonic multi sensor with Ecowitt EC0002 heater (WS80)
Ecowitt Anemometer 5-in-1 array (WS68)
Froggit DP80 rain gauge (WH40) with spikes
Froggit indoor temp/humidity/pressure (WH32B)
Froggit DP50 Internal temp/humidity x2 (WH31)
Ecowitt Outdoor temp/humidity & RS-00001 shield (WH32)
Froggit DP200 PM2.5 outdoor (WH41)
Ecowitt indoor CO2 PM2.5 PM10 (WH45)
Froggit DP100 soil moisture (WH51)
Froggit DP60 Lightning detector (WH57)
Froggit DP1500 server dongle (GW1000A) x2
Raspberry Pi 4 / WeeWx-GW1000 API interface
WU: IKNEBW2

Offline Douglasdeg

  • Member
  • *
  • Posts: 3
Re: Ecowitt.net API release
« Reply #92 on: January 13, 2023, 04:21:14 PM »
I've been using Econowitt for a while. However, his new API was limited. I mean, there were not enough cities or villages I needed to provide weather information to site visitors. On the website of our travel agency, you can get tickets for unique tours to small towns in Greece, Egypt, and Italy. But there were no such features in the Econowitt like the sea/sailing weather API. So I switched to a more convenient API by the Weather Data website. In addition, it's suitable for the mobile version of our website, and it opens well on mobile devices. So it was a great decision. But if Econowitt now has the features, then that's wonderful.
« Last Edit: January 14, 2023, 12:23:08 PM by Douglasdeg »

Offline watsonm

  • Member
  • *
  • Posts: 38
Re: Ecowitt.net API release
« Reply #93 on: January 15, 2023, 04:28:58 AM »
I did something similar to Oliver  but made it more general.
This is for my windows system so you may need to change the  os.system('cls') for the clear screen on whatever system you are running it on...

Code: [Select]
#! /usr/bin/python3
# test the Ecowitt.net-API v3 functionality
import requests
import json
import os
import time

# user settings
APIKey = "insert your own API key "                                                    # your API key
APPKey = "insert your own APP key"                                                    # your APP key
MACAddr = "Insert MAC Adddress"                                                   # MAC address of  Ecowitt device "AA:BB:CC:DD:EE:FF"

call_back = "all"

class WEATHER:
   def __init__(self, parm1,parm2,parm3, parm4 ):

       self.parm1 = parm1
       self.parm2 = parm2
       self.parm3 = parm3
       self.parm4 = parm4

element = {}
element[0]       = WEATHER('outdoor'       ,'temperature'    , 'value', 'unit')
element[1]       = WEATHER('outdoor'       ,'humidity'       , 'value', 'unit')
element[2]       = WEATHER('indoor'        ,'temperature'    , 'value', 'unit')
element[3]       = WEATHER('indoor'        ,'humidity'       , 'value', 'unit')
element[4]       = WEATHER('solar_and_uvi' ,'solar'          , 'value', 'unit')
element[5]       = WEATHER('rainfall'      ,'rain_rate'      , 'value', 'unit')
element[6]       = WEATHER('rainfall'      ,'hourly'         , 'value', 'unit')
element[7]       = WEATHER('wind'          ,'wind_speed'     , 'value', 'unit')
element[8]       = WEATHER('wind'          ,'wind_gust'      , 'value', 'unit')
element[9]       = WEATHER('wind'          ,'wind_direction' , 'value', 'unit')
element[10]      = WEATHER('pressure'      ,'relative'       , 'value', 'unit')
element[11]      = WEATHER('pressure'      ,'absolute'       , 'value', 'unit')

# Ecowitt-settings
APIURL = "https://api.ecowitt.net/api/v3/device/"
httpTimeOut = 10

def getFromEcowitt(url):
  ret = ""
  try:
    headers = {'Connection': 'Close','User-Agent': None}
    r = requests.get(url,timeout=httpTimeOut)
    ret = r.text.strip()
  except requests.exceptions.Timeout as err:
    ret = "TIMEOUT"
  except requests.exceptions.ConnectionError as err:
    ret = "CONNERR"
  except requests.exceptions.RequestException as err:
    ret = "REQERR"
  return ret

jdata = json.loads(getFromEcowitt(APIURL+"real_time?application_key="+APPKey+"&api_key="+APIKey+"&mac="+MACAddr+"&call_back="+call_back))

while 1:

   jdata = json.loads(getFromEcowitt(APIURL+"real_time?application_key="+APPKey+"&api_key="+APIKey+"&mac="+MACAddr+"&call_back="+call_back))
   os.system('cls')
   print("\n\n     My Weather \n")
   
   for index  in range(12):

      item_value = str(jdata['data'][element[index].parm1][element[index].parm2][element[index].parm3])
      item_unit  = str(jdata['data'][element[index].parm1][element[index].parm2][element[index].parm4])

      if index == 0 or index == 2:
          # convert value of F to C
          item_value = (float(item_value) -32 ) * 5/9
          item_unit = '\u00b0C'
      elif index == 10 or index == 11:
          # convert  value of in hg to mb
          item_value = float(item_value)  * 33.86389
          item_unit = 'hPa'
      elif index == 9 :
          item_unit = '\u00b0'


      item_value     = round(float(item_value), 1)
      print(element[index].parm1+ " " + element[index].parm2 + "  \t: "  + str(item_value) + "  "  + str(item_unit))

   time.sleep(20)

I am sure you can tweek the sleep time and see when Ecowitt complain you are hitting them too much   :roll:
I am a retired assembler programmer and am just learning Linux.  I expect the code can be improved!!    :shock:
Regards Mike

Raspberry Pi 4
Directly connected : BMP388 pressure sensor.  DHT22 For internal Humidity Sensor temp
Wireless connected: 3 Temperature Transmitters(WS2083), WH57  Lightning Sensor, Fine Offset Solar sensor  (stand alone)

 

anything