hass-browser_mod: Popups no longer work in 0.106
After updating to HA core 0.106, popups no longer work and i’m getting this error in the logs:
browser_mod.js:56:274 Uncaught TypeError: Cannot assign to read only property '0' of object '[object Array]'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 29 (2 by maintainers)
I was able to get it working again - with a hacky method. The problem lies with the object (n) being read-only on the deviceID array. The way I got it working was to turn the object into a JSON string and then parse the JSON string back into an object. That removes the read-only constraint and allows ‘this’ to be properly written to a deviceID.
In the browser_mod.js file (/homeassistant/custom_components/browser_mod/browser_mod.js) on line 60, column 170 after
const t=e.callService;e.callService=(e,o,n)=>{add the following:n=JSON.stringify(n);n=JSON.parse(n);Your code should look like this once added:
const t=e.callService;e.callService=(e,o,n)=>{n=JSON.stringify(n);n=JSON.parse(n);if(n&&n.deviceID)if(Array.isArray(n.deviceID)){Attached is an updated browser_mod.js in txt format. Download this, change extension to js and overwrite the existing file. browser_mod.txt
I am not going to submit this as a fix as it is a pretty hacky, but wanted to help you all out.
DISCLAIMER: This works in my scenario. I hope it works for everyone, but I only tested a specific scenario.
Hey everyone. Could you please try release 25, and see if that fixes this? When properly installed, your browser console should say “BROWSER_MOD 1.0.2 IS INSTALLED”.
With some fooling around I have discovered that disabling the deviceID tag allows all popups to work. Obviously they will open on all devices but all is better than none!
Same for me.
http://ha-address/browser_mod.js:56:274 Uncaught TypeError: Cannot assign to read only property '0' of object '[object Array]'Strange thing is that I have this error only with picture-elements cards tap_action.
I have the same problem. Removing the deviceID does not seem to make a difference. Keeping my fingers crossed for a fix.
I’m having the same issue after update to 0.106.2 If I call the browser_mod.popup with the button entity row it works. If call browser_mod.popup with the normal tap_action I get the error