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

Fire index value sensor #297

Closed cloneofghosts closed 1 month ago

cloneofghosts commented 3 months ago

I've been monitoring the data and it's been bang on. It's even picking up that I'm in a small higher risk pocket!

image

One addition that might be useful is a fire risk level sensor, or maybe that value can just be included as an attribute to the fire index sensors. Most people won't understand how the fire index correlates to the more meaningful risk level. I suppose this could be covered in the docs as well so one could just create their own template sensor if needed.

image

The OpenUV integration does something similar.

image

I've already done it in a template for myself.

template:
  - sensor:
      - name: "Fire Risk Level"
        unique_id: fire_risk_level
        icon: mdi:fire
        state: >
          {% set level = states('sensor.pirateweather_fire_index') | int(-1) %}
          {% if level >= 30 %} Extreme
          {% elif level >= 20 %} Very High
          {% elif level >= 10 %} High
          {% elif level >= 5 %} Moderate
          {% else %} Low
          {% endif %}
        availability: "{{ is_number(states('sensor.pirateweather_fire_index')) }}"

This is how I end up displaying it in the HA ui.

image

Originally posted by @jazzyisj in https://github.com/Pirate-Weather/pirateweather/issues/119#issuecomment-2088343476

cloneofghosts commented 3 months ago

Looks like this comment from @jazzyisj got missed from back in May. I remember trying to look into this but couldn't figure anything out.

I'll ping @alexander0042 to see if it's something that could be setup.

cloneofghosts commented 2 months ago

@alexander0042 Just wanted to check in to see if this is possible? I've setup the Fire Index template provided above but would be nice if it could be available natively.

If it is possible it may make sense to integrate a global fire index source before adding this to the integration.

alexander0042 commented 1 month ago

This is very possible! I'm adding a sensor into 1.6.0 that does this now.

Do you have a source for those risk levels? Just to document where they come from?

cloneofghosts commented 1 month ago

Not sure. I just created an issue from the comment that @jazzyisj left in the fire index issue in the main repo.

alexander0042 commented 1 month ago

I see that now! I just referenced the comment, the levels seem reasonable to me, so I'm on board!

This is included in 1.6.0 PR, and added to the docs (I remembered for once!)

jazzyisj commented 1 month ago

@alexander0042

Just to document where they come from

https://cwfis.cfs.nrcan.gc.ca/maps/fm3?type=fwih

image
cloneofghosts commented 1 month ago

@alexander0042 Posted this in the other issue but maybe it got missed:

Did a quick test and it seems to work though after I added the fire index sensor the fire index level sensor wasn't added and I see no way to select it. Also the comments will need to be updated as I just copied one from somewhere else to fix the lint issues.