Comments (5)
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.
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.
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.
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.
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)
- Errors and warnings in log HOT 10
- Template Variable Error HOT 6
- Ignore specific types of alerts HOT 6
- Icon for red flag warning HOT 1
- NULL values HOT 4
- Huge number of errors in Home Assistant log when there are no active alerts for my area HOT 11
- Adding a C on the end of the state? HOT 1
- Thousands of DNS Queries Per Day Made to "api.weather.gov" HOT 2
- Need help with sensor being unavalible HOT 2
- Attributes not set correctly HOT 2
- Incorrect type in weatheralerts_1.yaml, Line 2647 HOT 1
- Duplicated Alerts from NWS - fix provided HOT 1
- What, if anything, needs to change after upgrading from pre-v0.1.2 to v0.1.5? HOT 1
- Customer Automation Alerts broke after 0.1.5 update
- Timeout Error HOT 1
- Template sensors reporting -- data HOT 1
- Error when compiling weatheralerts yaml HOT 1
- no sensor being created HOT 1
- Invalid config for 'homeassistant' at packages/weatheralerts_1.yaml, line 2643 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weatheralerts.