Giter Club home page Giter Club logo

Comments (10)

dacarson avatar dacarson commented on July 17, 2024 1

As the data simply isn't available to the 2.5 API, the user can just go the plugin settings, expand the 'Hide values' section and check UV Index, Dew Point, Sunrise Time and Sunset Time. Then those items won't appear in HomeKit.

A possible programatic solution is lazily add the Characteristics. If, when updating that weather data, the Accessory is missing the Characteristic for a given reportCharacteristics name, then create and add it on the fly. (Or remove it on the fly - though this would be more work IMO)
In this scenario, UV, Dewpoint, SunriseTime and SunsetTime would be added to the list of reportCharacteristics only when the 3.0 API availability is confirmed.

from homebridge-weather-plus.

Churro-blaze avatar Churro-blaze commented on July 17, 2024

I have the same issue. The UV is the only thing I want so I can send an alert when it gets over 6 to put sunblock on the kids. I hope someone can work it out.

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

Please attach logs

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

Duplicate of #264

from homebridge-weather-plus.

jkreileder avatar jkreileder commented on July 17, 2024

This seems to depend on whether you have a paid subscription for the 3.0 API.
If you don't, the plugin falls back to use /data/2.5/weather instead of /data/3.0/onecall - and /data/2.5/weather doesn't have dew point and UV index.

The real question here is weather the 3.0 Onecall API is really needed here at all. /data/2.5/onecall seems to provide virtually the same data in the same structure. (See 3.0 and 2.5 docs).

This change makes dew point and UV index work for me. (That is, the whole 2.5 legacy code probably can be removed):

diff --git a/apis/openweathermap.js b/apis/openweathermap.js
index 9341d04..f1f0894 100644
--- a/apis/openweathermap.js
+++ b/apis/openweathermap.js
@@ -459,7 +459,7 @@ class OpenWeatherMapAPI
                }
                else
                {
-                       return this.apiBaseURL + "/data/3.0/onecall"
+                       return this.apiBaseURL + "/data/2.5/onecall"
                }
        }

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

The real question here is weather the 3.0 Onecall API is really needed here at all. /data/2.5/onecall seems to provide virtually the same data in the same structure. (See 3.0 and 2.5 docs).

Doing a diff between to the two sample results, I see 3.0 had a current.wind_gust value, a daily.summary value. Otherwise it had all the same fields. Moving to 2.5 onecall would seem to solve all the issues.

from homebridge-weather-plus.

jkreileder avatar jkreileder commented on July 17, 2024

Now for the bad news: Apparently 2.5/onecall is disabled for newer accounts (see domoticz/domoticz#5336 (comment)). So the only real solution for dew point and UV index is to get a base subscription, so that you can use 3.0/onecall: Basically enter payment details, then set a limit so you don't ever get over the 1000 free calls.

This issue and #264 then probably should be closed as "won't fix" because that behaviour is documented in the README.md

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

To stop Dew Point and UV index from appearing when 2.5 API is used, there is code tries to remove it from the reported characteristics:

	that.log.info("Could not retreive weather report with API 3.0, trying API 2.5 now ...")
	this.api = "2.5";
	this.removeCharacteristic(this.reportCharacteristics, "UVIndex");
	this.removeCharacteristic(this.reportCharacteristics, "DewPoint");
	this.removeCharacteristic(this.forecastCharacteristics, "UVIndex");
	this.removeCharacteristic(this.forecastCharacteristics, "DewPoint");
	this.removeCharacteristic(this.forecastCharacteristics, "SunriseTime");
	this.removeCharacteristic(this.forecastCharacteristics, "SunsetTime");
	this.forecastDays = 5;

The code for removeCharacteristic() is later in the same file:

	removeCharacteristic(characteristics, item)
	{
		let index = characteristics.indexOf(item);
		if (index !== -1)
		{
			characteristics.splice(index, 1);
		}
	}

Which just removes it from the array of data that is reported. Unfortunately, by this time the characteristic has already been added by the function CurrentConditionsWeatherAccessory() as a Characteristic of the Accessory. So the effect that the removeCharacteristic() function has is to always fail to report that value.

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

Can you please try 3.3.4-beta.1 and verify that it works.

from homebridge-weather-plus.

dacarson avatar dacarson commented on July 17, 2024

Closing as fixed. Try 3.3.4 or later

from homebridge-weather-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.