nws_alerts icon indicating copy to clipboard operation
nws_alerts copied to clipboard

UndefinedError: 'None' has no attribute 'split'

Open gdg316 opened this issue 2 years ago • 1 comments

Having issue with this Code

and I get UndefinedError: 'None' has no attribute 'split' , I have Variables and I have changed sensor to My Alerts with my location but not sure why I am getting the error?? and for some reason the title Parsing will not show up in my entities after adding to config.yaml

######################################################################################### title: "Alerts"

type: custom:vertical-layout layout: max_cols: 4 cards:

  • type: custom:stack-in-card cards:
    • type: entities title: Severe Weather Alerts show_header_toggle: false entities: sensor.nws_alerts

    • type: conditional conditions:

      • entity: sensor.nws_alerts state_not: '0' card: type: markdown content: >

        NWS First Active Alert

        {% if state_attr('sensor.nws_alerts', 'title') != None and state_attr('sensor.nws_alerts', 'title').split(' - ')[0] is defined %}

        {{ states.sensor.nws_alerts.attributes.title.split(' - ')[0] }}

        {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[0] }}

        {% else %} none {% endif %}

    • type: conditional conditions:

      • entity: sensor.nws_alerts state_not: "0"

      • entity: sensor.nws_alerts state_not: "1" card: type: markdown content: >

        NWS Second Active Alert

        {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[1] is defined %}

        {{ states.sensor.nws_alerts.attributes.title.split(' - ')[1] }}

        {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[1] }}

        {% else %} none {% endif %}

    • type: conditional conditions:

      • entity: sensor.nws_alerts state_not: "0"

      • entity: sensor.nws_alerts state_not: "1"

      • entity: sensor.nws_alerts state_not: "2" card: type: markdown content: >

        NWS Third Active Alert

        {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[2] is defined %}

        {{ states.sensor.nws_alerts.attributes.title.split(' - ')[2] }}

        {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[2] }}

        {% else %} none {% endif %}

    • type: conditional conditions:

      • entity: sensor.nws_alerts state_not: "0"

      • entity: sensor.nws_alerts state_not: "1"

      • entity: sensor.nws_alerts state_not: "2"

      • entity: sensor.nws_alerts state_not: "3" card: type: markdown content: >

        NWS Fourth Active Alert

        {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[3] is defined %}

        {{ states.sensor.nws_alerts.attributes.title.split(' - ')[3] }}

        {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[3] }}

        {% else %} none {% endif %}

    • type: conditional conditions:

      • entity: sensor.nws_alerts state_not: "0"

      • entity: sensor.nws_alerts state_not: "1"

      • entity: sensor.nws_alerts state_not: "2"

      • entity: sensor.nws_alerts state_not: "3"

      • entity: sensor.nws_alerts state_not: "4" card: type: markdown content: >

        NWS Fifth Active Alert

        {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[4] is defined %}

        {{ states.sensor.nws_alerts.attributes.title.split(' - ')[4] }}

        {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[4] }}

        {% else %} none {% endif %}

    • type: entities title: NWS Alerts History show_header_toggle: false state_color: true entities:

      • variable.nws_alerts_event_ids
      • type: custom:entity-attributes-card heading_name: Name heading_state: State entity: variable.nws_alerts_event_ids filter: include: - variable.nws_alerts_event_ids.history_1 - variable.nws_alerts_event_ids.history_2 - variable.nws_alerts_event_ids.history_3 - variable.nws_alerts_event_ids.history_4 - variable.nws_alerts_event_ids.history_5 - variable.nws_alerts_event_ids.history_6 - variable.nws_alerts_event_ids.history_7 - variable.nws_alerts_event_ids.history_8 - variable.nws_alerts_event_ids.history_9 - variable.nws_alerts_event_ids.history_10

gdg316 avatar Oct 23 '22 19:10 gdg316

@finity69x2 your YouTube video was great - just trying to figure out this error so I can configure for thunderstorms , hurricanes , heavy rains, heat advisory, etc

gdg316 avatar Oct 23 '22 19:10 gdg316

Sorry so late with this but I don't have a youtube video. None at all.

Are you still experiencing issues?

finity69x2 avatar Dec 13 '22 00:12 finity69x2