zigbee2mqtt-frontend icon indicating copy to clipboard operation
zigbee2mqtt-frontend copied to clipboard

Exposes of custom device is reading 'length' of undefined

Open nedtheant opened this issue 1 year ago • 2 comments

What happened?

I've modified my converter for a custom button device I am making to have the following fields: exposes: [e.battery(), e.action()], with the thought of having the action (on or off) of the button exposed to use elsewhere.

Here's the rest of the converter if it helps: converter.txt

After modifying this and restarting, I go to the "Exposes" tab of one of the devices and get hit with the congrats you've found a bug screen. Not sure if this is my fault of Z2Ms fault...

initialState.json.zip

What browsers are you seeing the problem on?

Chrome

Relevant stacktrace

**Current url**: http://192.168.16.229:8080/#/device/0x6c5cb1fffe586072/exposes
**Previous url**: http://192.168.16.229:8080/#/


**Error type**: TypeError
**Error message**: Cannot read properties of undefined (reading 'length')



TypeError: Cannot read properties of undefined (reading 'length')
    at net (http://192.168.16.229:8080/assets/index-adb29eee.js:85:213943)
    at y2 (http://192.168.16.229:8080/assets/index-adb29eee.js:41:19551)
    at u9 (http://192.168.16.229:8080/assets/index-adb29eee.js:43:44101)
    at o9 (http://192.168.16.229:8080/assets/index-adb29eee.js:43:39819)
    at m3e (http://192.168.16.229:8080/assets/index-adb29eee.js:43:39745)
    at Yy (http://192.168.16.229:8080/assets/index-adb29eee.js:43:39596)
    at hC (http://192.168.16.229:8080/assets/index-adb29eee.js:43:35959)
    at sF (http://192.168.16.229:8080/assets/index-adb29eee.js:43:36764)
    at Xs (http://192.168.16.229:8080/assets/index-adb29eee.js:41:3288)
    at http://192.168.16.229:8080/assets/index-adb29eee.js:43:34286

Did you download state.json.zip?

I will attach state.json.zip

nedtheant avatar Feb 01 '24 03:02 nedtheant

I have made a pull request fixing this bug here. Close this issue when merged :)

nedtheant avatar Feb 01 '24 05:02 nedtheant

Changing from e.action() to e.enum('action', ea.STATE, ['on', 'off']) in the converter avoids this issue (if anyone is struggling as well before the fix is merged).

nedtheant avatar Feb 02 '24 00:02 nedtheant