ebaauw / homebridge-ws

Homebridege plugin for virtual weather station
Apache License 2.0
106 stars 4 forks source link

Weather in Text ? #15

Closed Pblondin123 closed 4 years ago

Pblondin123 commented 4 years ago

Hi i believe this is a nice to have request rather than an issue. Just installed WS and am wondering if the actual text of the weather (e.g. 'Sunny', 'Rain') could be passed as an attribute. Would like to use such attribute to eventually code triggers e.g. when sunny then ... Thanks !

Pblondin123 commented 4 years ago

.. actually i see in the log that the text is passed in the condition attribute. I was not able to see this in homekit so i will do some more research on how to get that setting out

ebaauw commented 4 years ago

Apple's Home app only supports standard HomeKit services and characteristics (and not even all of them). Use another HomeKit app, like Eve, to see the custom ones. If you create a scene in Eve with these custom characteristics, you can still recall the scene in Home or Siri.

Afaik it's not possible to base triggers nor conditions for HomeKit automations on text characteristics.

Pblondin123 commented 4 years ago

Hi thanks i just checked Eve attributes and i did not see the condition attribute (to inquire on the weather condition text). Other than Temperature and Humidity levels (avail in Homekit) i saw Windspeed, Visibility, and Air Pressure. Let me know if am on the right track. Would be cool to inquire for condition = Sunny and call a water the lawn scene for example. Thanks

ebaauw commented 4 years ago

You should see it when viewing the accessory in the room. As I said, you can only use numeric characteristics in automation triggers and conditions. We would have to expose the condition (also) as a numeric code for your use case.

Pblondin123 commented 4 years ago

got it thanks. Indeed i see the condition text in the accessory. Ok to expose as a numeric but i suspect could be cumbersome to track the different combinations to expose. My need was just a nice to have hence should be low priority in the backlog :-). Thanks

ebaauw commented 4 years ago

I'm not sure if there's any standard coding of conditions. OpenWeatherMap does return some more data, but I think weather[].id and weather[].icon are specific to it. But as long as that's the only weather provider we support, we could use these.

See also https://openweathermap.org/weather-conditions.

{
  "coord": {
    "lon": -0.13,
    "lat": 51.51
  },
  "weather": [
    {
      "id": 803,
      "main": "Clouds",
      "description": "broken clouds",
      "icon": "04d"
    }
  ],
  "base": "stations",
  "main": {
    "temp": 22.09,
    "feels_like": 19.07,
    "temp_min": 20,
    "temp_max": 23.89,
    "pressure": 1022,
    "humidity": 40
  },
  "visibility": 10000,
  "wind": {
    "speed": 3.6,
    "deg": 100
  },
  "clouds": {
    "all": 77
  },
  "dt": 1586605277,
  "sys": {
    "type": 1,
    "id": 1414,
    "country": "GB",
    "sunrise": 1586581949,
    "sunset": 1586631001
  },
  "timezone": 3600,
  "id": 2643743,
  "name": "London",
  "cod": 200
}
{
  "coord": {
    "lon": 151.21,
    "lat": -33.87
  },
  "weather": [
    {
      "id": 800,
      "main": "Clear",
      "description": "clear sky",
      "icon": "01n"
    }
  ],
  "base": "stations",
  "main": {
    "temp": 14.64,
    "feels_like": 6.8,
    "temp_min": 12.78,
    "temp_max": 16.11,
    "pressure": 1010,
    "humidity": 41
  },
  "visibility": 10000,
  "wind": {
    "speed": 8.7,
    "deg": 250,
    "gust": 13.9
  },
  "clouds": {
    "all": 0
  },
  "dt": 1586613330,
  "sys": {
    "type": 1,
    "id": 9600,
    "country": "AU",
    "sunrise": 1586549670,
    "sunset": 1586590649
  },
  "timezone": 36000,
  "id": 2147714,
  "name": "Sydney",
  "cod": 200
}
Pblondin123 commented 4 years ago

looks good - so that we (end users) would be dependant on the weather id's which i believe is fine Thanks!

Pblondin123 commented 4 years ago

btw if those could be presented as well maybe some folks could automate with some more precision. Just a thought: "feels_like"; "temp_min"; "temp_max";

ebaauw commented 4 years ago

Above commit exposes weather[0].id as Status. I need to create new custom characteristics for the temperatures. I already have Sunrise and Sunset for Homebirdge Hue (virtual Daylight sensor), might as well use these here as well.

ebaauw commented 4 years ago

In v2.2.26.