Open villakarow opened 5 years ago
you need to set the card type to module not js when you create it's reference.
Thanks. I changed to module. Now I get two errormessages:
First message:
http://192.168.178.30:8123/local/custom_ui/dark-sky-weather-card.js?v=8:191:72 Uncaught TypeError: Cannot read property 'attributes' of undefined
var nextSunSet = new Date(this.hass.states[this.config.entity_sun].attributes.next_setting).toLocaleTimeString(this.config.locale, {hour: '2-digit', minute:'2-digit'});
of which column 72 is where "attributes.next_setting..." starts.
Second message - this I do not know what it means:
https://unpkg.com/@polymer/polymer@3.1.0/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property 'attributes' of undefined
Hope you can help. Thanks a lot. And by the way - there is no error to be seen in the UI. Nothing of the cutom card is showed.
They are the same error. its pointing to entity_sun not being defined. What is the value of sun.sun in the states debug panel. There should also be several attributes displayed in cluding next_setting, etc If these aren't there make sure you have the sun platform setup. (it is by default when you first start using HA but some folks might disable it)
The sun.sun platform is running. See screenshot - also a lot of attributes:
sun.sun | below_horizon | next_dawn: 2019-01-14T06:31:18+00:00 next_dusk: 2019-01-14T15:58:18+00:00 next_midnight: 2019-01-13T23:14:59+00:00 next_noon: 2019-01-14T11:14:48+00:00 next_rising: 2019-01-14T07:11:19+00:00 next_setting: 2019-01-14T15:18:17+00:00 elevation: -15.23 azimuth: 254.7 friendly_name: Sun |
---|
Oh, but I see that my entity is named: "sun.sun" and not "sun" only as you wrote. Is this relevant? Did I setup a wrong platform?
In my configuration.yaml it is setup as follows:
#Track
the sun
sun:
Can you post your ui_lovelace config?
Sure, here it is:
################################################################################################
# Resources #
################################################################################################
resources:
- url: /local/custom_ui/dark-sky-weather-card.js?v=8 #7.1
type: module # doesn't work (refer to https://github.com/iammexx/home-assistant-config/tree/master/ui/darksky)
- url: /local/custom.card-modder.js
type: js
title: My Awesome Home
views:
- title: Überblick
cards:
# Gefiltete Schalter, nur wenn "on"
- type: entity-filter
entities:
- entity: switch.meq0421869
name: Teichpumpe
icon: mdi:water-pump
- entity: switch.meq0582507_1
name: Zisterne
icon: mdi:water-pump
- entity: switch.meq0582507_2
name: Baumlicht
icon: mdi:lightbulb
- entity: switch.meq0582507_3
name: Licht Haus
icon: mdi:lightbulb
- entity: switch.meq0582507_4
name: Teichlicht
icon: mdi:lightbulb
- entity: switch.meq1898346
name: Vitrine Flur
icon: mdi:lightbulb
- entity: sensor.0001d709900f80_current
name: Warmwasserpumpe
- entity: sensor.0001d7098da17f_current
name: Blumenfenster rechts
- entity: switch.0001d7098da17f
name: Blumenfenster rechts
icon: mdi:lightbulb
- entity: switch.0001d709900f80
name: Warmwasserpumpe
icon: mdi:water-pump
- entity: light.wohnzimmer_links
name: Stehlampe links
icon: mdi:floor-lamp
- entity: light.wohnzimmer_rechts
name: Stehlampe links
icon: mdi:floor-lamp
#- entity: switch.0001d709900f0e
# name: Blumenfenster links
# icon: lightbulb
state_filter: "on"
card:
type: glance
title: Nur eingeschaltete Schalter
show_state: false
# Vertikale Cards mit verschiedener Anzeige, wenn Fenster alle zu oder mindestens eines offen ist
- type: vertical-stack
cards:
# Markdown nur wenn ALLE Fenster zu sind
- type: conditional
conditions:
- entity: binary_sensor.oeq1425607_state
state: "off"
- entity: binary_sensor.oeq1427068_state
state: "off"
- entity: binary_sensor.oeq1425249_state
state: "off"
card:
type: markdown
content: >
## Keine offenen Fenster
backround: green
# Gefiltete Fenster, wenn mindestens ein Fenster offen
- type: entity-filter
entities:
- entity: binary_sensor.oeq1425607_state
name: Dachfenster Bad
icon: mdi:lock
- entity: binary_sensor.oeq1427068_state
name: WC unten
icon: mdi:lock
- entity: binary_sensor.oeq1425249_state
name: Terrassentür
icon: mdi:lock
state_filter:
- "on"
# Card only for darksky (not for sensor)
- type: weather-forecast
entity: weather.dark_sky
# Raumtemperaturen Soll/Ist
- type: entities
entities:
- entity: climate.oeq0300156
name: Wohnzimmer
icon: mdi:sofa
- entity: climate.oeq1706423
name: Bad
icon: mdi:shower
- entity: climate.oeq1706430
name: Küche
icon: mdi:pot-mix
- entity: climate.oeq1705960
name: Schlafzimmer
icon: mdi:heart-multiple
- entity: climate.oeq0240844
name: WC unten
icon: mdi:toilet
title: Raumtemperaturen (Soll/Ist)
show_header_toggle: false
# Batteriezustand Rauchmelder
- type: entities
title: Batterie Zustand
entities:
- entity: binary_sensor.oeq0751047_state
name: Rauchmelder Flur oben
icon: mdi:battery
- entity: binary_sensor.oeq0932127_state
name: Rauchmelder Flur unten
icon: mdi:battery
show_header_toggle: false
#homematicraspi Servicemeldungen
- type: entities
title: Homematic Servicemeldungen
entities:
- entity: homematic.homematicraspi
icon: mdi:raspberrypi
show_header_toggle: false
#Schalter & Licht
- title: Schalter & Licht
cards:
# Schalter im Flur
- type: entities
title: Flur
show_header_toggle: false
entities:
- entity: switch.meq1898346
name: Vitrine Flur
icon: mdi:lightbulb
# Schalter im Garten
- type: entities
title: Garten
show_header_toggle: false
entities:
- entity: switch.meq0421869
name: Teichpumpe
icon: mdi:water-pump
- entity: switch.meq0582507_1
name: Zisterne
icon: mdi:water-pump
- entity: switch.meq0582507_2
name: Baumlicht
icon: mdi:lightbulb
- entity: switch.meq0582507_3
name: Licht Haus
icon: mdi:lightbulb
- entity: switch.meq0582507_4
name: Teichlicht
icon: mdi:lightbulb
# Schalter im HWR
- type: entities
title: HWR
show_header_toggle: false
entities:
- entity: switch.0001d709900f80
name: Warmwasserpumpe
icon: mdi:water-pump
# Schalter im Wohnzimmer
- type: entities
title: Wohnzimmer
show_header_toggle: false
entities:
- entity: switch.0001d7098da17f
name: Blumenfenster rechts
icon: mdi:lightbulb
#- entity: switch.0001d709900f0e
# name: Blumenfenster links
- entity: group.all_lights
name: Beide Stehlampen
icon: mdi:floor-lamp
- entity: scene.gruppe_wohnzimmer_hell
name: Helles Licht
icon: mdi:lightbulb-on
- entity: scene.gruppe_wohnzimmer_kerzen
name: Kerzenlicht
icon: mdi:candle
- entity: scene.gruppe_wohnzimmer_lesen
name: Leselicht Heiko
icon: mdi:book-open-page-variant
- entity: scene.gruppe_wohnzimmer_tv
name: Fernsehlicht
icon: mdi:television
- entity: scene.gruppe_wohnzimmer_wald
name: Waldgefühl
icon: mdi:pine-tree
- entity: scene.gruppe_wohnzimmer_redlight
name: Redlight
icon: mdi:heart-multiple
# Gefiltete Schalter, nur wenn "on"
- type: entity-filter
entities:
- entity: switch.meq0421869
name: Teichpumpe
icon: mdi:water-pump
- entity: switch.meq0582507_1
name: Zisterne
icon: mdi:water-pump
- entity: switch.meq0582507_2
name: Baumlicht
icon: mdi:lightbulb
- entity: switch.meq0582507_3
name: Licht Haus
icon: mdi:lightbulb
- entity: switch.meq0582507_4
name: Teichlicht
icon: mdi:lightbulb
- entity: switch.meq1898346
name: Vitrine Flur
icon: mdi:lightbulb
- entity: switch.0001d7098da17f
name: Blumenfenster rechts
icon: mdi:lightbulb
- entity: switch.0001d709900f80
name: Warmwasserpumpe
icon: mdi:water-pump
- entity: light.wohnzimmer_links
name: Stehlampe links
icon: mdi:floor-lamp
- entity: light.wohnzimmer_rechts
name: Stehlampe links
icon: mdi:floor-lamp
state_filter:
- "on"
card:
type: glance
title: Nur eingeschaltete Schalter
show_state: false
# Button cards mit Schalterfunktion
#- type: entity-button
# entity: switch.meq0582507_2
# name: Baumlicht
# icon: mdi:lightbulb
# tap_action:
# action: call-service
# service: light.turn_on
# service_data:
# entity_id: MEQ0582507 2
# Licht-Icon
#- type: light
# entity: switch.meq0582507_2
# Wetter
- title: Wetter
cards:
# Card only for darksky (not for sensor)
- type: weather-forecast
entity: weather.dark_sky
# Wetterkarte live + draußen
- type: iframe
url: https://embed.windy.com/embed2.html
# Sensors coming from darkky.sensor
- type: entities
show_header_toggle: false
entities:
- entity: sensor.dark_sky_daily_summary
name: HEUTE
- entity: sensor.dark_sky_apparent_temperature
name: Aktuell gefühlte Temperatur
- entity: sensor.dark_sky_precip_probability_0
name: Regenwahrscheinlichkeit
- entity: sensor.daylight
name: Sonnenstand
- entity: sensor.moon
name: Mondphase
- entity: sensor.dark_sky_uv_index
name: UV-Index
- entity: sensor.dark_sky_summary_1
name: MORGEN
- entity: sensor.dark_sky_daytime_high_apparent_temperature_1
name: Gefühlte Temperatur
- entity: sensor.dark_sky_precip_probability_1
name: Regenwahrscheinlichkeit
- entity: sensor.dark_sky_uv_index_1
name: UV-Index
- entity: sensor.dark_sky_nearest_storm_distance
name: Erwarteter Sturm
# - entity: sun.sun
# name: Sonne
# card: glance
#Heizung
- title: Heizung
cards:
# Heizungsthermostate
- type: thermostat
entity: climate.oeq0300156
name: Wohnzimmer
- type: gauge
entity: sensor.oeq0300156_humidity
severity:
yellow: 0
green: 40
red: 65
name: Wohnzimmer
- type: thermostat
entity: climate.oeq1706423
name: Bad
- type: thermostat
entity: climate.oeq1706430
name: Küche
- type: thermostat
entity: climate.oeq1705960
name: Schlafzimmer
- type: thermostat
entity: climate.oeq0240844
name: WC unten
#Media
- title: Media
cards:
# Mediaplayer
- type: entities
title: Mediaplayer
entities:
- entity: media_player.tv
name: Wohnzimmer TV
- entity: media_player.bose_kuche
name: Bose Küche
icon: mdi:wifi
- entity: media_player.bad
name: Bad
- entity: media_player.buro
name: Büro
show_header_toggle: false
# Denon
- type: media-control
entity: media_player.denon_avr
#Fenster
- title: Fenster
cards:
#Tür und Fensterkontakte
- type: entities
title: Fenster
entities:
- entity: binary_sensor.oeq1425607_state
name: Dachfenster Bad
icon: mdi:lock
- entity: binary_sensor.oeq1427068_state
name: WC unten
icon: mdi:lock
- entity: binary_sensor.oeq1425249_state
name: Terrassentür
icon: mdi:lock
show_header_toggle: false
#Test
- title: Test
cards:
# Attribute von Thermostaten
# - type: entities
# title: Test
# entities:
# - entity: climate.oeq1706423
# - entity: climate.oeq1706430
# name: Küche
# icon: mdi:pot-mix
- type: entities
title: Anwesenheit
entities:
- entity: device_tracker.heikoss8
show_header_toggle: false
- type: custom:dark-sky-weather-card
entities:
- entity_sun: sun.sun
- entity_daily_summary: sensor.dark_sky_daily_summary
- entity_current_conditions: sensor.dark_sky_icon
- entity_humidity: sensor.dark_sky_humidity
- entity_pressure: sensor.dark_sky_pressure
- entity_temperature: sensor.dark_sky_temperature
- entity_visibility: sensor.dark_sky_visibility
- entity_wind_bearing: sensor.dark_sky_wind_bearing
- entity_wind_speed: sensor.dark_sky_wind_speed
- entity_forecast_high_temp_1: sensor.dark_sky_daytime_high_temperature_1
- entity_forecast_high_temp_2: sensor.dark_sky_daytime_high_temperature_2
- entity_forecast_high_temp_3: sensor.dark_sky_daytime_high_temperature_3
- entity_forecast_high_temp_4: sensor.dark_sky_daytime_high_temperature_4
- entity_forecast_high_temp_5: sensor.dark_sky_daytime_high_temperature_5
- entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_0
- entity_forecast_low_temp_2: sensor.dark_sky_overnight_low_temperature_1
- entity_forecast_low_temp_3: sensor.dark_sky_overnight_low_temperature_2
- entity_forecast_low_temp_4: sensor.dark_sky_overnight_low_temperature_3
- entity_forecast_low_temp_5: sensor.dark_sky_overnight_low_temperature_4
- entity_forecast_icon_1: sensor.dark_sky_icon_1
- entity_forecast_icon_2: sensor.dark_sky_icon_2
- entity_forecast_icon_3: sensor.dark_sky_icon_3
- entity_forecast_icon_4: sensor.dark_sky_icon_4
- entity_forecast_icon_5: sensor.dark_sky_icon_5
- entity_summary_1: sensor.dark_sky_summary_1
- entity_summary_2: sensor.dark_sky_summary_2
- entity_summary_3: sensor.dark_sky_summary_3
- entity_summary_4: sensor.dark_sky_summary_4
- entity_summary_5: sensor.dark_sky_summary_5
locale: de
static_icons: false
sunset: true
tooltips: true
tooltip_bg_color: 'rgb( 75,155,239)'
tooltip_border_color: orange
tooltip_border_width: 3
tooltip_caret_size: 10
tooltip_fg_color: '#fff'
tooltip_left_offset: -5
tooltip_width: 100
# Test Anzeige von Ventileinstellungen
# - type: gauge
# entity: sensor.oeq0300156_temperature
# - type: gauge
# entity: sensor.oeq1706423_temperature
#- type: custom:card-modder
# style:
# --paper-card-background-color: rgba(0, 100, 0, 0.2)
# --paper-item-icon-color: white
# border-radius: 5px
# color: rgb(0, 0, 100)
# card:
# type: "custom:card-modder"
# title: Styled card
# entities:
# - light.bed_light
# - light.ceiling_lights
# - light.kitchen_lights
#- type: glance
# title: Unstyled card
#entities:
# - light.bed_light
#- light.ceiling_lights
#- light.kitchen_lights
# Gefiltete Fenster, nur wenn offen
# - type: conditional
# conditions:
# - entity: binary_sensor.oeq1425607_state
# state: "off"
# - entity: binary_sensor.oeq1427068_state
# state: "off"
# - entity: binary_sensor.oeq1425249_state
# state: "off"
# card:
# - resources:
# - url: /local/card-modder.js
# type: js
# - type: custom:card-modder
# titel: ## Keine offenen Fenster
# card:
# - type: markdown
# style:
# background-image: url("/local/lovelace/cardbackK.png")
# background-repeat: no-repeat
# background-color: rgba(50,50,50,0.3)
# background-size: 100% 160px
# border-radius: 20px
# border: solid 1px rgba(100,100,100,0.3)
# color: "#999999"
# box-shadow: 3px 3px rgba(0,0,0,0.4)
Is this still an issue ?
Unfortunately, yes it is.
Your config above generally looks correct...
If you use the Chrome developer tools and refresh the card, can you post the error messages you get in the console. This works best if you put the card by itself in its own view to cut down on the number of extraneous messages.
Are you using the latest version of the card ?
@villakarow I'm not sure this is the same thing, but I used wget to download the script off of the wrong url rather than "raw". Thus, I ended up with the html content of github rather than the necessary script. The error "on line 8" for me was the html5 tag.
Hi, thanks for your work. I have done as described (hopefully) but get this error massage.
http://hassio.local:8123/local/custom_ui/dark-sky-weather-card.js?v=8:1:8 Uncaught SyntaxError: Unexpected token {