Hello,
card-mod stopped working for me a few weeks ago, when I updated from the 2.x release to 3.x
The logs give the following error:
ERROR (MainThread) [frontend.js.latest.202103026] https://smarthome.viknyaos.com:8321/hacsfiles/lovelace-card-mod/card-mod.js:1:1 Uncaught SyntaxError: Identifier 's' has already been declared
Fold-entity row and Lovelace swipe navigation also give the same error, subsitution “identifier ‘s’” as another single letter. (n, l, etc.)
Refreshing the page a dozen or so times will eventually lead to everything working, but then fail the next dozen times the page is loaded. So it’s not a consistent bug.
HomeAssistant version 2021.3.3
Side by side image below:
And my lovelace config:
background: center / cover no-repeat url("/local/background-15.gif") fixed
#swipe_nav:
#wrap: false
#animate: swipe
#prevent_default: true
#swipe_amount: 20
style: &disarmedStatusStyle |
ha-card {
background-color: rgba(0,255,0,1);
background-image: url("/local/cardbackK.png");
background-repeat: no-repeat;
background-size: 100% 100%;
font-size: 20pt;
text-align: center;
}
style: &armedStatusStyle |
ha-card {
background-color: rgba(255,0,0,1);
background-image: url("/local/cardbackK.png");
background-repeat: no-repeat;
background-size: 100% 100%;
font-size: 20pt;
text-align: center
}
style: &windowDoorOpenStatusStyle_auto-entities |
ha-card {
background-color: rgba(255,255,0,1);
background-image: url("/local/cardbackK.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.card-header {
font-size: 20pt;
text-align: center;
}
style: &cardStyle |
ha-card {
background-image: url("/local/cardbackK.png");
border: solid 2px rgba(100,100,100,0.3);
background-color: rgba(50,50,50,0.3);
background-repeat: no-repeat;
background-size: 100% 100%;
box-shadow: 3px 3px rgba(0,0,0,0.4);
color: #999999;
}
decluttering_templates:
scene-button:
card:
type: custom:button-card
label: '[[label]]'
lock:
enabled: true
unlock: hold
show_label: true
show_entity_picture: true
entity_picture: '[[entity_picture]]'
aspect_ratio: 1/1
color_type: card
color: rgba(50, 50, 50, 0)
tap_action:
action: call-service
service: input_select.select_option
service_data:
entity_id: input_select.movie_mode
option: '[[option]]'
styles:
entity_picture:
- border-radius: 50%
- height: 100%
- width: 75%
label:
- font-size: 14x
card:
- box-shadow: none
state:
- operator: template
value: >
[[[
return states['input_select.movie_mode'].state == '[[option]]'
]]]
color: '#ffffcc'
styles:
label:
- color: '#000000'
light_button_toggle:
card:
type: entity-button
style: *cardStyle
entity: '[[entity]]'
tap_action:
action: toggle
light_button_more_info:
card:
type: entity-button
style: *cardStyle
entity: '[[entity]]'
tap_action:
action: more-info
aux_sensor_card_vertical:
card:
type: custom:button-card
entity: '[[entity]]'
icon: 'mdi:[[icon]]'
show_state: true
show_name: false
#show_icon: true
layout: icon_state
tap_action:
action: more-info
styles:
state:
- font-size: 20px
- color: '#999999'
card:
- padding: 0px 0px 0px 0px
style: |
ha-card {
background-color: rgba(50, 50, 50, 0);
box-shadow: 0px 0px;
}
temp_humidity_stack:
card:
type: entities
show_header_toggle: false
title: '[[title]]'
style: |
ha-card {
background-image: url("/local/cardbackK.png");
border: solid 2px rgba(100,100,100,0.3);
background-color: rgba(50,50,50,0.3);
background-repeat: no-repeat;
background-size: 100% 100%;
box-shadow: 3px 3px rgba(0,0,0,0.4);
color: #999999;
padding: 0px 0px 0px 0px;
}
.card-header {
padding: 16px 16px 8px 16px;
}
entities:
- type: custom:hui-vertical-stack-card
cards:
- type: custom:decluttering-card
template: aux_sensor_card_vertical
variables:
- entity: '[[temperature]]'
- icon: thermometer
- type: custom:decluttering-card
template: aux_sensor_card_vertical
variables:
- entity: '[[humidity]]'
- icon: water-percent
alarm_sensor_status:
card:
type: custom:auto-entities
show_empty: false
card:
type: glance
title: "Alarm Sensors Detected:"
columns: 3
show_state: false
style: *windowDoorOpenStatusStyle_auto-entities
filter:
include:
- group: group.zigbee_alarm_sensors
state: "on"
options:
tap_action:
action: navigate
navigation_path: /lovelace/security/
- entity_id: binary_sensor.*z*
state: "on"
options:
tap_action:
action: navigate
navigation_path: /lovelace/security/
- entity_id: binary_sensor.refrigerator_door
state: "on"
alarm_status:
card:
type: horizontal-stack
cards:
- type: conditional
conditions:
- entity: alarm_control_panel.home
state: "disarmed"
card:
type: markdown
title:
content: System Disarmed
style: *disarmedStatusStyle
- type: conditional
conditions:
- entity: alarm_control_panel.home
state: "armed_away"
card:
type: markdown
title:
content: System Armed
style: *armedStatusStyle
views:
- title: Home
path: default_view
icon: mdi:home
badges: []
cards:
- type: custom:decluttering-card
template: alarm_status
- type: custom:decluttering-card
template: alarm_sensor_status
- type: horizontal-stack
cards:
- card: null
entities:
- entity: device_tracker.nicholas_phone_ping
- entity: device_tracker.pixel_3_xl
entity: group.nicholas_device_tracker
image: /local/njpic.png
state_filter:
not_home: grayscale(90%) blur(2px)
title: Nicholas
type: picture-glance
style: *cardStyle
- card: null
entities:
- entity: device_tracker.lesley_phone_ping
- entity: device_tracker.samsung_sm_g955u
entity: group.lesley_device_tracker
image: /local/lbpic.png
state_filter:
not_home: grayscale(90%) blur(2px)
title: Lesley
type: picture-glance
style: *cardStyle
- type: weather-forecast
entity: weather.dark_sky
name: Home
style: *cardStyle
show_forecast: false
- type: entities
style: *cardStyle
show_header_toggle: false
title: Volume
entities:
- type: 'custom:slider-entity-row'
entity: media_player.living_room_speaker
- type: 'custom:slider-entity-row'
entity: media_player.kitchen_speaker
- type: entities
style: *cardStyle
show_header_toggle: false
entities:
#- switch.nursery_humidifier
#- type: divider
- switch.bedroom_fan
- switch.nursery_humidifier_switch
- input_boolean.night_mode
- input_boolean.alarm_clock
- type: custom:time-picker-card
style: |
ha-card {
background-color: rgba(50,50,50,0.0);
color: #999999;
}
entity: input_datetime.wakeup_time
layout:
embedded: true
name: inside
align_controls: right
- type: custom:fold-entity-row
head:
type: section
label: Night Mode Options
entities:
- input_boolean.night_mode_nicholas_lamp
- input_boolean.night_mode_lesley_lamp
- input_boolean.night_mode_fan
- input_number.fan_delay
#- input_boolean.night_mode_tv_news
- input_boolean.night_mode_radio_news
- type: horizontal-stack
cards:
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.lesley_lamp
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.nicholas_lamp
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.back_porch
- type: horizontal-stack
cards:
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.square_standing_lamp_light
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.window_lamp
#- type: custom:decluttering-card
#$template: light_button_toggle
#variables:
#- entity: light.front_porch
- type: custom:gap-card
- type: horizontal-stack
cards:
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.laundry_room_light
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.kitchen_lights
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.coffee_table
- type: horizontal-stack
cards:
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.mantle
- type: custom:gap-card
- type: custom:decluttering-card
template: light_button_toggle
variables:
- entity: light.nursery_lamp
- type: entities
title: Color Scenes
show_header_toggle: false
style: *cardStyle
entities:
- type: custom:hui-vertical-stack-card
cards:
- type: horizontal-stack
cards:
- type: custom:decluttering-card
template: scene-button
show_entity_picture: false
variables:
- label: Reset
- option: Normal
- entity_picture: /local/scenes/off.jpg
- type: custom:decluttering-card
template: scene-button
variables:
- label: Watermelon
- entity_picture: /local/scenes/watermelon.gif
- option: Watermelon
- type: custom:decluttering-card
template: scene-button
variables:
- label: Blue & Red
- option: "Blue & Red"
- entity_picture: /local/scenes/blue_red.jpg
- type: custom:decluttering-card
template: scene-button
variables:
- label: Arctic
- option: Arctic
- entity_picture: /local/scenes/arctic.jpg
- title: Security
path: security
icon: mdi:shield-home
badges: []
cards:
- type: custom:decluttering-card
template: alarm_status
- type: entities
title: Actions
show_header_toggle: false
style: *cardStyle
entities:
- type: call-service
action_name: Disarm/Clear Alarm
icon: mdi:home
name: Disarm/Clear Alarm
service: alarm_control_panel.alarm_disarm
service_data:
entity_id: alarm_control_panel.home
- type: call-service
action_name: Arm Away
icon: mdi:security
name: Arm Away
service: script.turn_on
service_data:
entity_id: script.arm_away
- type: custom:logbook-card
entity: alarm_control_panel.home
title: Alarm History
style: *cardStyle
max_items: 4
state_map:
- label: Armed
value: armed_away
- label: Disarmed
value: disarmed
show:
duration: false
end_date: false
- type: vertical-stack
cards:
- type: custom:auto-entities
card:
type: entities
title: Alarm Sensors - ON
style: *cardStyle
show_header_toggle: false
#secondary_info: last-changed
filter:
include:
- group: group.zigbee_alarm_sensors
state: "on"
- entity_id: binary_sensor.*z*
state: "on"
- type: custom:auto-entities
card:
type: entities
title: Alarm Sensors - OFF
style: *cardStyle
show_header_toggle: false
filter:
include:
- group: group.zigbee_alarm_sensors
state: "off"
- entity_id: binary_sensor.*z*
state: "off"
- type: entities
title: Status
show_header_toggle: false
style: *cardStyle
entities:
- sensor.home_keypad
- type: call-service
action_name: "* Key"
icon: mdi:security
name: "* Key"
service: envisalink.alarm_keypress
service_data:
entity_id: alarm_control_panel.home
keypress: "*"
- sensor.ac_on_off
- sensor.battery_good_bad
- sensor.alarm_panel_trouble
- title: Cameras
path: cameras
badges: []
icon: mdi:camera
cards:
- type: vertical-stack
cards:
- type: picture-entity
camera_view: live
entity: camera.back_yard
show_state: false
show_name: false
- type: picture-entity
camera_view: live
entity: camera.front_yard
show_state: false
show_name: false
- type: picture-entity
camera_view: live
entity: camera.nursery
show_state: false
show_name: false
- type: picture-entity
camera_view: live
entity: camera.kennel
show_state: false
show_name: false
- title: Garden
path: garden
badges: []
icon: mdi:fruit-cherries
cards:
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
style: *cardStyle
entities:
- sensor.greenhouse_therm_temperature
show:
extrema: true
hours_to_show: 72
points_per_hour: 1
decimals: 1
- type: custom:mini-graph-card
style: *cardStyle
entities:
- sensor.greenhouse_therm_humidity
show:
extrema: true
hours_to_show: 72
points_per_hour: 1
decimals: 0
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
style: *cardStyle
entities:
- sensor.dark_sky_temperature
show:
extrema: true
hours_to_show: 72
points_per_hour: 1
decimals: 1
- type: custom:mini-graph-card
style: *cardStyle
entities:
- sensor.dark_sky_humidity
show:
extrema: true
hours_to_show: 72
points_per_hour: 1
decimals: 0
- type: picture-entity
camera_view: live
entity: camera.garden_cam
show_state: false
show_name: false