GithubHelp home page GithubHelp logo

Comments (5)

regularguy01 avatar regularguy01 commented on May 26, 2024 1

I fixed this by adding

.split('urn:oid:2.49.0.1.840.0.')[1],

on line 193 of sensor.py

the full line looks like
"id": properties.get("id", "null").split('urn:oid:2.49.0.1.840.0.')[1],

The URN (universal registered number) never changes for NWS and is specific to the USA.

Then you don't need yaml

from weatheralerts.

jlverhagen avatar jlverhagen commented on May 26, 2024

Thanks for the report. The NWS changed the alert ID format at some point and made them much longer. I think I can fix it by adding a second input_text helper and splitting the alert IDs between two input_text helpers. It should only take some minor adjustments to the UI Notification automation.

from weatheralerts.

kaijk avatar kaijk commented on May 26, 2024

Thanks for your attention to this. We happen to have some residual/reappearing winter that is generating a flurry ;) of NWS alerts that make for good testing.

Might you use an attribute to store these data? Attributes are not bound by the 255 character limit for an entity's state .

from weatheralerts.

mjnovotny82 avatar mjnovotny82 commented on May 26, 2024

We could pipe in a replace() to remove urn:oid:2.49.0.1.840.0. from the alert IDs in your weatheralerts.yaml file. You would want to add | replace('urn:oid:2.49.0.1.840.0.','') to each of the five [0-4] alert_id sections . This should drop it down to around 234 characters.

Before

      alert_id: >-
        {% if not is_state('sensor.weatheralerts_1', '0') and not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
          {{ states.sensor.weatheralerts_1.attributes.alerts[0].id }}
        {% else %}
          None
        {% endif %}
    # skip some lines #
      alert_id: >-
        {% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_2', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 1)) %}
          {{ states.sensor.weatheralerts_1.attributes.alerts[1].id }}
        {% else %}
          None
        {% endif %}

After

      alert_id: >-
        {% if not is_state('sensor.weatheralerts_1', '0') and not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
          {{ states.sensor.weatheralerts_1.attributes.alerts[0].id | replace('urn:oid:2.49.0.1.840.0.','') }}
        {% else %}
          None
        {% endif %}
    # skip some lines #
      alert_id: >-
        {% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_2', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 1)) %}
          {{ states.sensor.weatheralerts_1.attributes.alerts[1].id | replace('urn:oid:2.49.0.1.840.0.','') }}
        {% else %}
          None
        {% endif %}
    # rinse and repeat for [2], [3], [4] #

I have not see urn:oid:2.49.0.1.840.0. changed in year plus of using weatheralerts.

from weatheralerts.

kaijk avatar kaijk commented on May 26, 2024

I'm trying your suggestion @mjnovotny82. We should be having a full compliment of alerts over the next few days.

I'd also considered using an attribute for the data instead of a state, but haven't pursued it.

from weatheralerts.

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.