Home-Assistant-Lovelace-Local-Conditional-card
Home-Assistant-Lovelace-Local-Conditional-card copied to clipboard
TypeError: Cannot assign to read only property 'ids' of object '#<Object>'
Hello,
I have just started using the local conditional card on my Hassio, however I've encountered a problem when using the local_conditional_card.set method.
A reduced version of my config:
type: vertical-stack
title: Lights
cards:
- type: grid
cards:
- type: button
tap_action:
action: call-service
service: local_conditional_card.set
service_data:
ids:
- lights_mancave: true
- lights_living_room: false
target: {}
icon: 'mdi:bat'
show_name: false
hold_action:
action: navigate
navigation_path: /lovelace/man_cave
- type: button
tap_action:
action: call-service
service: local_conditional_card.set
service_data:
ids:
- lights_mancave: false
- lights_living_room: true
target: {}
show_name: false
icon: 'mdi:sofa'
hold_action:
action: navigate
navigation_path: /lovelace/living_room
- type: 'custom:local-conditional-card'
default: hide
id: lights_mancave
card:
type: grid
columns: 5
cards:
- type: button
- type: 'custom:local-conditional-card'
default: hide
id: lights_living_room
card:
type: grid
columns: 5
cards:
- type: button
unfortunately only the last card works, and anything I click results in this error being produced on the chrome console:
Uncaught (in promise) TypeError: Cannot assign to read only property 'ids' of object '#<Object>'
at Object.hass.callService (local-conditional-card.js:51)
at u (chunk.2c2eabf….js:320)
at HTMLElement.value (chunk.04e66a2….js:966)
at g.handleEvent (app.ebe75b7a.js:12795)
at HTMLElement.__boundHandleEvent (app.ebe75b7a.js:12795)
at i (app.ebe75b7a.js:12795)
at HTMLElement.e.actionHandler.t.disabled.e.actionHandler.end (chunk.2c2eabf….js:320)
hass.callService @ local-conditional-card.js:51
u @ chunk.2c2eabf….js:320
value @ chunk.04e66a2….js:966
handleEvent @ app.ebe75b7a.js:12795
__boundHandleEvent @ app.ebe75b7a.js:12795
i @ app.ebe75b7a.js:12795
e.actionHandler.t.disabled.e.actionHandler.end @ chunk.2c2eabf….js:320
The line in question is: https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/blob/b3de1beef86f283639266379a32f0443ac01df6d/dist/local-conditional-card.js#L51
I have corrected this problem by replacing that line with:
serviceData = { ids: new_ids };
@PiotrMachowski I'll submit a PR for your approval, hope you'll find this helpful,
Cheers,
Alex
I don't believe I have permissions to push to this repo, so won't be able to open a PR. Hopefully the solution I provided can still be implemented to fix the issue
@alexanderphoenix you should be able to make a PR, but you have to fork this repo first.
Thanks for your investigation!
Thank you @PiotrMachowski, sorry I should've realised. I've now submitted the PR, it works locally to my installation, but I've not tested all scenarios.
Fixed in v2.0.0