Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OW move from 2.5 to 3.0 call #200

Open
gargamelonly opened this issue Apr 19, 2024 · 21 comments
Open

OW move from 2.5 to 3.0 call #200

gargamelonly opened this issue Apr 19, 2024 · 21 comments

Comments

@gargamelonly
Copy link

Any affect on SprinklersPi due to the following change:
"We would like to inform you about our plans to complete the migration from One Call 2.5 to One Call 3.0 that started 2 years ago. In line with this, access to One Call 2.5 will be finally closed in June 2024.

One Call 3.0 provides you with significantly advanced business-demanded features such as a minute forecast for 1 hour, 4 days forecast for any timestamp, a daily forecast for 8 days, including a human-readable summary, historical data (45-year archive) for timestamps, and with daily aggregation, 1.5-year long-term forecast with daily aggregation, and others."

@nhorvath
Copy link
Collaborator

nhorvath commented Apr 19, 2024

Yes, we use 2.5. There's a PR open for OW3 I need to review.

@gargamelonly
Copy link
Author

Thank you for all your work.
Please update when it is released.

One question:
Since OW3 API requires a subscription (and credit card details) with 1000 free calls a month (at this point in time).
Could you please note how many calls a day does sprinklers_pi request?

Side note; I see homeassistant "Smart Irrigation" HACS integration using OW3 API.

@nhorvath
Copy link
Collaborator

nhorvath commented May 17, 2024 via email

@gargamelonly
Copy link
Author

Just got an email that OW API 2.5 will stop working today. Did you get it too?

"We would like to inform you that we started One Call 2.5 deprecation, and your access to the product will be stopped on October 7, 2024."

@srthimsen
Copy link

There's a branch with support for OW 3 here:
https://github.com/rszimm/sprinklers_pi/tree/ow3

It's what I'm currently using and it seems to be reasonable so far, but I'm at the end of my watering season (about to blow out sprinklers to protect against freezing).

@gargamelonly
Copy link
Author

gargamelonly commented Oct 8, 2024

I don't understand how do you use it?
support for OW3 is not yet in the official release

@srthimsen
Copy link

Personally, I just built it on a spare SD card and started fresh.

@gargamelonly
Copy link
Author

gargamelonly commented Oct 22, 2024

@nhorvath
I don't understand how to use the "branch" mentioned above.
Please, we need your urgent support for this issue to update the code.
API 2.5 stopped working.

@nhorvath
Copy link
Collaborator

I don't have time to clean this up and merge yet. I'm pretty sure the new code is not completely functional.

I created a release candidate off the branch for you to try. Backup first!

cd /usr/local/etc
sudo tar czf spinklers_pi.bak.tgz sprinklers_pi

https://github.com/rszimm/sprinklers_pi/releases/tag/v2.0.0rc1

@gargamelonly
Copy link
Author

Thank you so much.

building...
I am just following the upgrade instruction, I have no proficiency in writing and making.
I see a leftover for 1.7.0 during the build:
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.7.0\" "

@gargamelonly
Copy link
Author

gargamelonly commented Oct 22, 2024

just cosmetics: I am also seeing "Powered by Sprinklers Pi V1.7.0"
I would like to help in any way I can to make this official.
What should I look for to verify the complete functionality?
Just run it I can see now that weather data is available.
Before it had a timeout and all zones were at 100% since information was not available to adjust the zones based on weather.

@nhorvath
Copy link
Collaborator

when i looked at it either the previous day or current day rainfall was suspect to me. i forget which. yeah the version number won't update until i do a real release.

@gargamelonly
Copy link
Author

gargamelonly commented Oct 23, 2024

I compared the code differences between 1.7.0 openweather.cpp and 2.0.0rc1 openweather3.cpp files and they are identical except one section dealing with (i==0) which did not exist in 1.7.0
If the rainfall in 1.7.0 worked ok then I see no reason for it not to work correctly now with 3.0 API calls.

if (i==0){
for (auto &hour : data["data"]) {
            rain = 0;
			temp += hour["temp"].get<float>();
			wind += hour["wind_speed"].get<float>();
			if (hour.count("rain") > 0 && hour["rain"].count("1h") > 0) {
                rain = hour["rain"]["1h"].get<float>();
                precip += rain;
			}
			humidity = hour["humidity"].get<short>();
/*
            trace("collected the following values:\ntemp: %0.2f\nwind: %0.2f\nprecip: %0.2f\nhumid: %0.2f\n",
                  hour["temp"].get<float>(), hour["wind_speed"].get<float>(), rain, humidity);
            trace("totals so far:\ntemp: %0.2f\nwind: %0.2f\nprecip: %0.2f\n\n",
                  temp, wind, precip);
*/
			if (humidity > ret->maxhumidity) {
				ret->maxhumidity = humidity;
			}
			if (humidity < ret->minhumidity) {
				ret->minhumidity = humidity;
			}
			if (++i > 24) {
			    break;
			}
		}
}

@nhorvath
Copy link
Collaborator

nhorvath commented Oct 23, 2024 via email

@gargamelonly
Copy link
Author

Here are a couple of log lines from the latest watering (we have no rain yet).

  1. What are the "ERROR!"s I see each minute? They existed even with 1.7.0
  2. The line with [json.exception.type_error.302] type must be number, but is null I assume it exists because when there is no rain to report the parameter is not reported. Is this correct?
2024/10/23 16:25:51 ERROR!
2024/10/23 16:26:51 Got a client
2024/10/23 16:26:51 ERROR!
2024/10/23 16:27:51 Got a client
2024/10/23 16:27:51 ERROR!
2024/10/23 16:28:52 Got a client
2024/10/23 16:28:52 ERROR!
2024/10/23 16:29:53 Got a client
2024/10/23 16:29:53 ERROR!
2024/10/23 16:30:00 Get Today's Weather
2024/10/23 16:30:01 curl error output: 
2024/10/23 16:30:01 Parsed the following values:
temp: 72
wind: 12.70
precip: 0.00
uv: 0.40
2024/10/23 16:30:01 Get Today's Weather for the hours between midnight and now
2024/10/23 16:30:06 curl error output: 
2024/10/23 16:30:06 [json.exception.type_error.302] type must be number, but is null
2024/10/23 16:30:06 Parsed the following values:
temp: 68
wind: 6.90
precip: 0.00
uv: 0.40
2024/10/23 16:30:06 Get Yesterday's Weather
2024/10/23 16:30:07 curl error output: 
2024/10/23 16:30:07 [json.exception.type_error.302] type must be number, but is null
2024/10/23 16:30:07 Parsed the following values:
temp: 76
wind: 21.90
precip: 0.00
uv: 0.40
2024/10/23 16:30:07 Adjusting H(-4)T(24)R(0):120
2024/10/23 16:30:07 Turning on Zone 4
2024/10/23 16:30:53 Got a client
2024/10/23 16:30:53 ERROR!
2024/10/23 16:31:53 Got a client
2024/10/23 16:31:53 ERROR!
2024/10/23 16:32:53 Got a client
2024/10/23 16:32:53 ERROR!
2024/10/23 16:33:53 Got a client
2024/10/23 16:33:53 ERROR!
2024/10/23 16:34:53 Got a client
2024/10/23 16:34:53 ERROR!
2024/10/23 16:35:54 Got a client
2024/10/23 16:35:54 ERROR!
2024/10/23 16:36:27 Got a client

@nhorvath
Copy link
Collaborator

nhorvath commented Oct 23, 2024 via email

@gargamelonly
Copy link
Author

I found out that it's not flaky pi networking. The ERRORs are because I have an OpenHAB automation pinging the pi and the service on port 8080 with no web request. It is just to check that the service is running. Detect and send me a Telegram alert if the service crashed (wifi disconnect or sd card got corrupted) which will cause watering to stop.

Do you have an idea about the json exception?

@nhorvath
Copy link
Collaborator

nhorvath commented Oct 24, 2024 via email

@gargamelonly
Copy link
Author

@keithfisher123
About OW API 3.0 support you have added.
Could you please check the [json.exception.type_error.302] type must be number, but is null error I mentioned above if it is related to the missing rain field in case there is not rain compared to API 2.5 ?

And another question for @keithfisher123 ; for curiosity, why did you add (i==0) ?

@gargamelonly
Copy link
Author

gargamelonly commented Oct 30, 2024

After a couple of days with the ow3 rc2.0 I come to a conclusion that it is not working as expected.
It is exaggerating in the actual percentage calculation of watering time with about 50% offset over normal watering (this is with no rain at all). It even waters excessively more than in summer season. Even if I set overall scale to 80% it still calculates and adds too much to the normal time.
My recommendation is not to use it, this has become useless.
I do not have the knowledge of finding out what is wrong and why it does that.
I enjoyed this project a lot. Need to go back to manual adjustment.

The API change for OW3 is when using the "timestamp" specific parameter.
When using it in API 2.5 the JSON included the "hourly" tag but now in API 3.0 it returns the information with the "data" json tag. This is the main reason that it needs modification.

@gargamelonly
Copy link
Author

How do I modify the following code so it is conditional if the "rain" parameter does not exist then skip parsing it?

	if (hour.count("rain") > 0 && hour["rain"].count("1h") > 0) {
                rain = hour["rain"]["1h"].get<float>();
                precip += rain;
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants