Replies: 14 comments 33 replies
-
Hi @BJReplay, you could definitely modify the weather411 code (here) to poll for this API data and store it in InfluxDB. But even if you didn't create a service for this, polling and putting this into InfluxDB isn't too difficult. Some options:
from influxdb import InfluxDBClient
# grab weather data from api and store in dict
# ...
# store data in InfluxDB
client = InfluxDBClient(host="localhost", port=8086, database="powerwall")
output = [{}]
output[0]["measurement"] = "pantech"
output[0]["time"] = weather["dt"]
output[0]["fields"] = {}
for i in weather:
output[0]["fields"][i] = weather[i]
print(output)
if client.write_points(output, time_precision='s'):
print("Succes")
else:
print("Error"
client.close()
# Pull TEMP value from API
TEMP=`curl ...` # whatever is used to pull temp from pantech API
# Save to InfluxDB
curl -XPOST 'http://localhost:8086/write?db=powerwall' --data-binary "pantech temp=${TEMP}"
Let us know what you discover or what you end up doing. I'm also open to hearing any better / generic ways for users to add their own weather data to the project. |
Beta Was this translation helpful? Give feedback.
-
Thanks @jasonacox and @mcbirse - those two hints are enough to get me going. The advantage that OpenWeatherMap has is cloud cover information (even though it is not necessarily correct - at times it says 100% when it is clear:) - it is nice to have), but the detail I've been able to get out of the local API is nice as it includes UVI and insolation data as W/m2 (note the example below is manually indented for readability, so the closing braces are not indented). For example, this is a recent call to real_time. It also has history data, and if I call it for a 24 hour period, I can get it at 5 minute resolution.
|
Beta Was this translation helpful? Give feedback.
-
@mcbirse Yeah, they are pretty good, and you can go crazy and add on all sorts of other sensors like soil moisture, lightning, multiple temperature, and so on. I've got a CO2, PM2.5 and PM10 sensor https://shop.ecowitt.com/products/wh45 that should arrive in the next couple of days as well as a replacement gateway https://shop.ecowitt.com/products/gw1100 because the internal display / console / display is on the way out - my current unit is a combo of the earlier model of this LCD display https://shop.ecowitt.com/products/ws2910_c and the earlier model of this external sensor array https://shop.ecowitt.com/products/ws69. I suspect that the main quartz crystal oscillator or driver circuitry is on the way out, as the display periodically freezes, and when it comes back to life, the time has also frozen. Given that the display is handy, but I monitor the temperature from an app, anyway, I've gone for the cheaper gateway replacement rather than a fancier display, but then splashed out on an air quality sensor. Gadgets!!! |
Beta Was this translation helpful? Give feedback.
-
OK, I've made pretty good progress: I've got the a modified version of weather411 server.py now working with the Ecowitt API, serving data on port 8686, and I've managed to include it in the powerwall.yml and get it to build into the docker compose, but I can't get it talking to InfluxDB. Parsing the Ecowitt API JSON is working (needed some re-work for different names, as well as structural differences), it is returning the weather data. I just need to figure out if I set up an InfluxDB username and password (though I don't think I did), or try to work out what the problem is writing to InfluxDB. Once I've sussed it out, I'll can either put together a pull request, or attach files to this discussion - @jasonacox let me know what is easiest for you to consider. There is a New (slightly modified from the weather411) Dockerfile, localweather.conf (again, based on the weather411.conf file), server.py, etc. Basically a whole new subdirectory that sits under Powerwall-Dashboard. It is focused on Ecowitt (and that whole OEM ecosystem) at the moment. I haven't modified the setup script, but by modifying the powerwall.yml, integrated it by doing a compose-dash.sh stop, followed by a compose-dash.sh up -d. It should be simple enough to clone the Q&A in the setup.sh section to also ask about do you have a local weather station using the Ecowitt API, I guess. |
Beta Was this translation helpful? Give feedback.
-
HI @jasonacox, I've had a few clear days away from this, a chance to think about it, and a chance to do some debugging, and these are my thoughts:
|
Beta Was this translation helpful? Give feedback.
-
See updated table below with a couple of changes. I've added in the notional data type - however it should be noted that the Ecowitt API all data as text fields (as a side note - this was the problem that sent me down my debugging rabbit hole - passing that time field as a timestamp in the write_points was failing, but the error wasn't obvious that it was the timestamp).
One other thought on measurement set name: an option (driven by the .conf) to allow the local weather to use the weather measurement - so that users can use the default dashboards with minimal modification by editing the config file. Weather Data Fields
|
Beta Was this translation helpful? Give feedback.
-
I'll pull together a pull request for a |
Beta Was this translation helpful? Give feedback.
-
The final piece in this puzzle is ready for testing - I've written a history tool that is ready for a brave tester to test. I'll submit a pull request shortly. It seems to work and I've pulled in history data for my local weather station back to 1 January 2019. |
Beta Was this translation helpful? Give feedback.
-
I am trying to get my Ecowitt data to display. I initially got data to show up on LocalWeather Server v0.2.2, but it was metric. I updated the ecowitt.conf file to imperial, rebooted, but values were null. I switched it back to metric to keep it consistent with the Powerwall temp reports. The values were still null until I made new Ecowitt API and APP codes. Now, Im back to data showing up in the LocalWeather Server. I created the powerwall.extend.yml file with the code on the page, but running compose-dash.sh yielded an error since the container Ecowitt already existed when running Step #2 in the quick start instructions. So I deleted it, reran compose-dash.sh, and it worked. There is still no data showing up on dashboard.json or dashboard-localweather.json. Do I need to edit the Dashboard code or run a setup file? I tried the Ecowitt Weather History Import Tool, but Im getting this error: "ERROR: Failed to write to InfluxDB: 400: {"error":"partial write: field type conflict: input field "humidity" on measurement "localweather" is type integer, already exists as type float dropped=5"}" |
Beta Was this translation helpful? Give feedback.
-
I ran into some problems with this as well - I'm in a region (Australia) that uses the metric system, but I think there are a couple of issues at play here:
It looks like you did, however. I think I can see the logic for the changes for Lines 530 and 534 - I'm guessing that if you measure pressure in inches of mercury, you need float (I'm using hPA, so it is a whole number). However, I'm less sure about the change on 553 and 556 - can you provide more information on the errors you were getting on CO2 and PM2.5 that were fixed by changing to int? My units are integers - e.g., 460 ppm and 1 μg/m³, but I'm surprised that you're getting an error. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
As the author for ecowitt, I'll have a look and see if I can work it out; that said, it's been a while since I set it up. The sample dashboard was just that. If you have trouble importing, you can change the Name and the UID as you import. I don't use the sample or the default; I use a heavily customised dashboard, but I'll have a look at the base dashboard and the sample, and see if I can work out what is missing from the instructions. Something has probably changed since I wrote the instructions, but the idea was that the replacement would be reasonably straight forward. |
Beta Was this translation helpful? Give feedback.
-
@BJReplay thankyou - my dev skills are near zero and I havent been in a technical IT ops role for a long time, so much of this is greek to me. Btw, the thing with the sample dashboard is weird, it does what the screen-cap shows, even if I delete the "local weather" dashboard and start from zero again. |
Beta Was this translation helpful? Give feedback.
-
P.S. signing off for tonight, so no more replies until tomorrow, sorry. |
Beta Was this translation helpful? Give feedback.
-
I have a Pantech branded Home Weather Station (of course I do - I'm a gadget geek) - Ecowitt (aka Fine Offset) are the OEM for a bunch of home weather stations, including Pantech, and probably most commonly known in the US is Ambient Weather.
I've just discovered (since my internal display died last night) that they have an API: https://doc.ecowitt.net/web/#/apiv3en?page_id=19
I knew that it was possible to intercept the output having read up on weewx interceptors, but now that they have an API, it seems feasible to provide an alternative weather input to Weather411 for the dashboard.
Here's a list of weatherstations from another site that talks about accessing their data utilising the wire protocol - but I suspect this is now superseded given there is an API: https://www.openhab.org/addons/bindings/fineoffsetweatherstation/
First steps will be to get the API working in Postman, and then to figure out how to get it up and running so that it can be included into grafana - I would welcome any suggestions!
Beta Was this translation helpful? Give feedback.
All reactions