Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
369 stars 26 forks source link

sunset_time & sunset_time sensors missing #58

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi!

I have added the following to my config monitored_conditions:

- sunset_time
- sunrise_time

However, these sensors do not appear. Is there something special about them?

alexander0042 commented 2 years ago

Hi,

Thanks for using this integration, and apologies for this issue! Quick question, are you using the HACS version or the config flow UI development version?

ghost commented 2 years ago

Hi

...and thank you for providing it! 👍

I am using the HACS version with HA container.

I also noticed some other sensors (that I just added) also don't show

- temperature_high
- temperature_low
alexander0042 commented 2 years ago

Interesting- do you see anything in the logs about this? I'll be honest, no one has asked about the sunset time sensors yet, so it hasn't been on my radar

ghost commented 2 years ago

no worries - I consider them a luxury item anyway.

...can't see anything in the logs though except for the known depreciated method topic (below) custom_components.pirateweather.weather::DarkSkyWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom integration author.

chicknlil commented 2 years ago

I just came here to report the same thing. I'm using pirate weather in conjunction with Platinum Weather Card and there are definitely things I can't fill in. At the moment I'm needing to use multiple weather providers to fill the gaps.

chicknlil commented 2 years ago

Seems to be also missing:

- temperature_min
- temperature_max
alexander0042 commented 2 years ago

I'm really sorry for my slow reply here. We have a 3-month old baby, and she is definitely taking a lot of the attention at the moment!

To follow both these questions up with another question, are you using this integration as a sensor or weather entity? If these are as sensors, then these parameters should be working, so that's a bigger problem.

If you're up for some light troubleshooting, I'd appreciate it if you could try this using the new version of this integration? This moves everything to the Home Assistant standard, which should solve this issue, and still includes both the weather and sensor entities.

chicknlil commented 2 years ago

I was using it as a sensor. I'm about an hour and a half away from my laptop, and then I will try that out!

ghost commented 2 years ago

We have a 3-month old baby, and she is definitely taking a lot of the attention at the moment!

congratulations!

I am (trying to) use all 4 as sensors and cannot see any of them. Also, which is correct?

- temperature_min
- temperature_max

or

- temperature_high
- temperature_low
alexander0042 commented 2 years ago

Thanks! You'll want to use:

- temperature_high
- temperature_low

as the other ones are officially depreciated. Do you mind pasting in the full block of your configuration.yaml (without the API key!), so I can take a look at how it's laid out?

chicknlil commented 2 years ago

Here's mine...

  - platform: pirateweather
    api_key: xxxxxx
    scan_interval: '00:15:00'
    monitored_conditions:
      - temperature
      - precip_probability
      - precip_type
      - humidity
      - cloud_cover
      - nearest_storm_distance
      - precip_intensity
      - wind_speed
      - summary
      - icon
      - apparent_temperature
      - wind_gust
      - wind_bearing
      - temperature_high
      - temperature_low
      - temperature_min
      - temperature_max
      - apparent_temperature_high
      - apparent_temperature_low
      - apparent_temperature_min
      - apparent_temperature_max
      - uv_index
      - sunrise_time
      - moon_phase
      - sunset_time
      - alerts
      - minutely_summary
      - precip_accumulation
      - dew_point
      - pressure
      - ozone
      - visibility
      - hourly_summary
ghost commented 2 years ago

this is mine (it's in a package)

weather:
  - platform: pirateweather
    api_key: !secret pirate_weather_api
    # Additional optional values:
    latitude: !secret home_latitude
    longitude: !secret home_longitude
    mode: "hourly" # (default) or "daily"
    #name: Pirate Weather

sensor: 
  - platform: pirateweather
    api_key: !secret pirate_weather_api
    scan_interval: '00:15:00'
    units: uk2
    monitored_conditions:
    # temp
      - temperature
      - apparent_temperature
      - dew_point
      - temperature_high    # The daytime high temperature.
      - temperature_low
      - pressure
      - humidity
    # rain
      - precip_probability
      - precip_type
      - precip_intensity
    # clouds
      - cloud_cover
      - uv_index
#       - nearest_storm_distance
    # wind
      - wind_speed
      - wind_gust
      - wind_bearing
    # summaries
      - minutely_summary
      - hourly_summary
      - daily_summary
#       - alerts # US only
    # sun
      - sunrise_time
      - sunset_time
chicknlil commented 2 years ago

I still don't have high or low showing as options, after following the steps in the other topic you linked.

alexander0042 commented 2 years ago

Ok, thanks for posting those configs, they explain what's going on here!

What's happening is both sunrise/sunset and temperature_high/temperature_low are daily forecast parameters, not current conditions. This means that they aren't in requested data from the server, so don't show up. The fix here is to add:

    forecast:
      - 0

under your api_key line for the sensors, similar to how it's described from the HA integration(https://www.home-assistant.io/integrations/darksky).

One thing I'm curious about is if these used to show up for Dark Sky and then stopped working when you switched to Pirate Weather, or if this is a new integration. One of my goals is backwards compatibility, so if it used to work, then that's an issue!

chicknlil commented 2 years ago

I wasn't using Darksky previously (because I knew it was going away). I found Pirate Weather while looking for a better weather integration that would work with the Platinum Weather Card I mentioned previously.

I had to further tweak my config.yaml after adding that line of code (removing reference to min/max, based on the error logs) ... that enabled me to do the check and restart.

That said, on restart it's working perfectly. Here's the end result with the platinum weather card (and a mini graph card in between): Overview-–-Home-Assistant (4)

ghost commented 2 years ago

One thing I'm curious about is if these used to show up for Dark Sky and then stopped working when you switched to Pirate Weather, or if this is a new integration. One of my goals is backwards compatibility, so if it used to work, then that's an issue!

I never used DarkSky either! ...working perfectly now - thanks!

alexander0042 commented 2 years ago

Love that weather card- I'll have to add it in to my configuration! I've tagged this as a documentation issue to remind me to clarify the instructions here on which variables are available for current conditions, which are hourly, and which are daily, since it's a pretty key detail!

Thanks again for using (and especially supporting!) this service, and let me know if you run into any other issues 🌤️

ghost commented 2 years ago

I wasn't using Darksky previously (because I knew it was going away). I found Pirate Weather while looking for a better weather integration that would work with the Platinum Weather Card I mentioned previously.

I had to further tweak my config.yaml after adding that line of code (removing reference to min/max, based on the error logs) ... that enabled me to do the check and restart.

That said, on restart it's working perfectly. Here's the end result with the platinum weather card (and a mini graph card in between): Overview-–-Home-Assistant (4)

Can you share your yaml for that card layout?

chicknlil commented 2 years ago

Sure. There's also a button card that's invisible unless there's a weather alert at the top...

type: vertical-stack
cards:
  - card:
      color: red
      color_type: card
      entity: sensor.pirateweather_alert_text
      layout: icon_state
      show_name: false
      show_state: true
      size: 100%
      styles:
        card:
          - height: 60px
        grid:
          - grid-template-areas: '"i s" "n n" "l l"'
          - grid-template-columns: 20% 1fr
          - grid-template-rows: 1fr min-content min-content
        state:
          - text-transform: uppercase
          - font-weight: bold
          - justify-self: start
      tap_action:
        action: fire-dom-event
        browser_mod:
          service: browser_mod.popup
          data:
            title: Alert Detail
            content:
              type: markdown
              content: >-
                ## {% if is_state('sensor.pirateweather_alerts','1')
                %}{{state_attr('states.sensor.pirateweather_alerts',
                'title')}}{% else
                %}{{state_attr('states.sensor.pirateweather_alerts',
                'title_0')}}{% endif %}  

                ### {% if is_state('sensor.pirateweather_alerts','0') %}No
                Weather Alerts {% elif
                is_state('sensor.pirateweather_alerts','1') %} Expires at {{
                state_attr('states.sensor.pirateweather_alerts', 'expires') |
                int | timestamp_custom("%-I:%M %p on %A")}} {% else %} Expires
                at {{ state_attr('states.sensor.pirateweather_alerts',
                'expires_0') | int | timestamp_custom("%-I:%M %p on %A")}} {%
                endif %}{% if is_state('sensor.pirateweather_alerts','1') %} {{
                state_attr('states.sensor.pirateweather_alerts', 'description')
                }} {% else %} {{
                state_attr('states.sensor.pirateweather_alerts',
                'description_0') }} {% endif %}
      type: custom:button-card
    conditions:
      - entity: sensor.pirateweather_alerts
        state_not: '0'
    type: conditional
  - card_config_version: 8
    daily_forecast_days: 5
    daily_forecast_layout: horizontal
    entity_apparent_temp: sensor.pirateweather_apparent_temperature
    entity_extended: sensor.pirateweather_minutely_summary
    entity_forecast_icon: sensor.pirateweather_icon
    entity_forecast_max: sensor.pirateweather_daytime_high_temperature_0d
    entity_forecast_min: sensor.pirateweather_overnight_low_temperature_0d
    entity_humidity: sensor.pirateweather_humidity
    entity_pop: sensor.pirateweather_precip_probability
    entity_pos: sensor.pirateweather_precip_probability
    entity_pressure: sensor.pirateweather_pressure
    entity_summary: sensor.pirateweather_summary
    entity_sun: sun.sun
    entity_temperature: sensor.pirateweather_temperature
    entity_todays_fire_danger: sensor.pirateweather_alerts
    entity_todays_uv_forecast: sensor.pirateweather_uv_index
    entity_uv_alert_summary: sensor.pirateweather_uv_index
    entity_visibility: sensor.pirateweather_visibility
    entity_wind_bearing: sensor.pirateweather_wind_bearing
    entity_wind_gust: sensor.pirateweather_wind_gust
    entity_wind_speed: sensor.pirateweather_wind_speed
    extended_name_attr: friendly_name
    extended_use_attr: false
    option_locale: US
    option_show_overview_decimals: true
    option_show_overview_separator: true
    option_time_format: 12hour
    option_tooltips: true
    overview_layout: complete
    section_order:
      - overview
      - extended
      - slots
      - daily_forecast
    show_section_extended: false
    slot_l1: forecast_max
    slot_l2: forecast_min
    slot_l3: pop
    slot_l4: remove
    slot_l5: remove
    slot_l6: remove
    slot_l7: remove
    slot_l8: remove
    slot_r1: sun_next
    slot_r2: sun_following
    slot_r3: remove
    slot_r4: remove
    slot_r5: empty
    slot_r6: remove
    slot_r7: remove
    slot_r8: remove
    text_card_title: Today's Forecast
    type: custom:platinum-weather-card
  - type: custom:mini-graph-card
    name: Temperature
    entities:
      - sensor.pirateweather_temperature
    hours_to_show: 24
    points_per_hour: 0.25
    color_thresholds:
      - value: 0
        color: '#ff0000'
      - value: 32
        color: '#ffff00'
      - value: 65
        color: '#00ff00'
      - value: 100
        color: '#0000ff'
  - card_config_version: 8
    custom1_icon: mdi:thermometer
    custom1_units: °F Outside
    custom1_value: sensor.b51788b47_remote_temperature
    custom2_icon: mdi:thermometer
    custom2_units: °F Inside
    custom2_value: sensor.thermostat_temperature
    entity_humidity: sensor.b51788b47_remote_humidity
    entity_pressure: sensor.pirateweather_pressure
    entity_uv_alert_summary: sensor.pirateweather_uv_index
    entity_visibility: sensor.pirateweather_visibility
    entity_wind_bearing: sensor.pirateweather_wind_bearing
    entity_wind_gust: sensor.pirateweather_wind_gust
    entity_wind_speed: sensor.pirateweather_wind_speed
    option_today_rainfall_decimals: true
    option_today_temperature_decimals: true
    overview_layout: title only
    section_order:
      - overview
      - extended
      - slots
      - daily_forecast
    show_section_daily_forecast: false
    show_section_extended: false
    show_section_slots: true
    slot_l1: custom1
    slot_l2: humidity
    slot_l3: wind
    slot_l4: pressure
    slot_l5: remove
    slot_l6: remove
    slot_l7: remove
    slot_l8: remove
    slot_r1: custom2
    slot_r2: uv_summary
    slot_r3: visibility
    slot_r4: empty
    slot_r5: remove
    slot_r6: remove
    slot_r7: remove
    slot_r8: remove
    text_card_title: Current Weather
    type: custom:platinum-weather-card
  - type: custom:mushroom-chips-card
    chips:
      - type: entity
        entity: sensor.pirateweather_alerts
        content_info: name
        name: Rain Radar
        icon: mdi:radar
        icon_color: indigo
        tap_action:
          action: navigate
          navigation_path: /lovelace/rain-radar
      - type: entity
        entity: sensor.pirateweather_alerts
        name: House Temps
        content_info: name
        icon: mdi:home-thermometer
        icon_color: light-green
        tap_action:
          action: navigate
          navigation_path: /lovelace/house-temps
    alignment: center
chicknlil commented 2 years ago

This is the sensor, for sensor.yaml...

sensor:
  #Pirate Weather Alert Text
  - platform: template
    sensors:
      pirate_weather_alert_text:
        entity_id: sensor.pirateweather_alerts
        friendly_name: 'Weather Alert Text'
        value_template: >-
          {% if is_state('sensor.pirateweather_alerts','0') %}
            No Weather Alerts
          {% elif is_state('sensor.pirateweather_alerts','1') %}
            {{ sensor.pirateweather_alerts.attributes.title }}
          {% else %}
            {{ sensor.pirateweather_alerts.attributes.title_0 }}
          {% endif %}
ghost commented 2 years ago

sensor:

Pirate Weather Alert Text

...

you might want to update that to the new format :)

template:
  - sensor:
      - name: pirate_weather_alert_text
        unique_id: pirateweather_alerts
        state: >-
          {% if is_state('sensor.pirateweather_alerts','0') %}
            No Weather Alerts
          {% elif is_state('sensor.pirateweather_alerts','1') %}
            {{ sensor.pirateweather_alerts.attributes.title }}
          {% else %}
            {{ sensor.pirateweather_alerts.attributes.title_0 }}
          {% endif %}
ghost commented 2 years ago

Adding...

forecast:
 - 0

has brought an unknown sensor sensor.pirateweather_precip_intensity_0d.

I bring this up because sensor.pirateweather_precip_intensity is fine.

If I add extra days to the forecast all the sensor.pirateweather_precip_intensity_xd sensors are unknown. All other _xd sensors are fine.

Is this an error or just how it is?

cheers!

alexander0042 commented 2 years ago

Oh wow! @jchhenderson, it doesn't look like much, but you actually found a bug in the API, not just the integration! Since my goal for the API is drop-in compatibility with Dark Sky, I try to return the same json structure as what they do, and never noticed that I was missing precip_intensity for the daily data block.

I'll push an update to the API itself to add this in, and you should notice these sensors start returning data later today. It'll just be accumulation divided by 24 hours, but since it's in Dark Sky, it needs to be here too!

chicknlil commented 2 years ago

hey @alexander0042 ... I was looking at my logs and they said to remove the pirateweather references from my config.yaml as they were no longer needed - I did, but now I no longer have access to those 0d sensors. Did I miss something, or did the logs mislead me?

This error originated from a custom integration.

Logger: custom_components.pirateweather.weather
Source: custom_components/pirateweather/weather.py:137
Integration: Pirate Weather (documentation, issues)
First occurred: 10:26:59 AM (1 occurrences)
Last logged: 10:26:59 AM

Configuration of Pirate Weather (weather entity) in YAML is deprecated Your existing configuration has been imported into the UI automatically and can be safely removed from your configuration.yaml file
ghost commented 2 years ago

hey @chicknlil can you start a new thread as this is a new topic? 👍

chicknlil commented 2 years ago

It's all related, but whatever dude. Done, you don't hafta worry about it cluttering up your precious thread. You're making me regret sharing my config with you. 🙄

ghost commented 2 years ago

No offence was meant. This thread isn't precious to me. I just couldn't see the link and find it confusing when 2 topics are discussed at the same time. My intention was to immediately help you on the new thread but I'll respectfully bow out as I have upset you. Once again, sorry.

chicknlil commented 2 years ago

No offence was meant. This thread isn't precious to me. I just couldn't see the link and find it confusing when 2 topics are discussed at the same time. My intention was to immediately help you on the new thread but I'll respectfully bow out as I have upset you. Once again, sorry.

I've let this sit to see if my thoughts changed on it at all; they have not. You were being an ass in your original reply to me, and the whole "I was going to help you but I'm not" is SUCH a passive aggressive nerd move. "I am superior to you, I'm going to make sure you know it, I'll make you think I can help, but I won't." ... kudos. You're the kind of person that makes me loathe tech communities in general.

ghost commented 2 years ago

Again, I am sorry that I upset you. It wasn’t intentional, but maybe you don’t realise that your first response (also passive-aggressive) was quite rude, upsetting and came as a shock to me as my intentions were honest - certainly not to be an ass.

Regardless, I tried to apologise and give space, which has also been misinterpreted. I don’t think anything I can write will change that, so I'm out.