icanos / hassio-plejd

Hass.io add-on for Plejd home automation devices
Apache License 2.0
126 stars 37 forks source link

LED-75 causes addon to fail #250

Closed vBrolin closed 1 year ago

vBrolin commented 1 year ago

Got a LED-75 from Plejd today for Beta testing. When I have it added to my home system, it causes the addon to fail. Tried getting logs out, but it fails rather early. Error says: Catastrophic error. Resetting entire addon in 1 minute Error: Unknown device type with id 36.

Also got a SPR-01 today that shows up but as an unknown model, also noticed I have a DIM-02 showing as unknown. Have checked the logs for hardware ID when setting both verbose and silly, but I don't get any hardware IDs. Most likely doing something wrong but can't figure it out, despite following the readme.

SweVictor commented 1 year ago

alright, so - the error you're seeing comes from here: https://github.com/icanos/hassio-plejd/blob/4ed7b4acb902406b94d1c2a80d7183206a9e016d/plejd/PlejdApi.js#L373

Just logging an error rather than crashing the program seems like it would have been the better choice. Either way - to fix it "for real" we would need hardware to add things to the lookup list above the linked line. Feel free to submit a PR!

Also - if someone can verify the hardware id:s for the missing devices, that would be nice as well.

Btw - the code calling the above function is here https://github.com/icanos/hassio-plejd/blob/4ed7b4acb902406b94d1c2a80d7183206a9e016d/plejd/PlejdApi.js#L431

We could catch the error there and log it more gracefully.

Regarding the hardware id:s, I think that should be logged at the very startup of the app in verbose or similar, but I might be wrong.

vBrolin commented 1 year ago

Been doing multiple startups, and removed the devices and adding them again both between startups and while running, but I'm not able to fetch the IDs for them. The changes you have proposed for logging would make this a lot easier.

BTW, LED-75 supports tunable white. The Dali puck also supports this, but I'm not sure that's supported either. That could perhaps need some move code. I might be able to get a Dali puck to get some info from as well if needed.

gust4vsson commented 1 year ago

Also beta tester of LED-75 here.

Screenshot_20220930-092335

So I tried adding this, stopping the addon and pressed rebuild and then restarted. Didnt seem to help.

I still get this:

Screenshot_20220930-095014

gust4vsson commented 1 year ago

Also I managed to snatch this

Screenshot_20220930-095946__01

Device ID is identical to the LED-75

Screenshot_20220930-100728

SweVictor commented 1 year ago

Just pushed a new branch meant to catch these types of errors, log some details and continue gracefully.

@vBrolin, @gust4vsson: Would be appreciated if you could try this version (refer to readme for manual install instructions) and report back if it works (as in addon continues). IF it continues without crashing, please paste the logs around Error trying to create output device that should provide details around the hardware information that the addon sees.

Branch is here: https://github.com/icanos/hassio-plejd/tree/feature/new-devices-2022-10

Edit: To be clear, I haven't tested the code. I don't have the LED-75 so I can't reproduce.

SM6WGG commented 1 year ago

Might want to update the case/hwid list a bit as well. ;)

HW ID: 1 Prod: DIM-01 1ch dimmer HW ID: 2 Prod: DIM-02 2ch dimmer HW ID: 3 Prod: CTR-01 1ch relay with 0-10v HW ID: 4 Prod: GWY-01 Gateway HW ID: 5 Prod: LED-10 LED dimmer HW ID: 6 Prod: WPH-01 Wireless wall switch HW ID: 8 Prod: SPR-01 Wall plugg relay HW ID: 10 Prod: WRT-01 Wireless rotary switch HW ID: 11 Prod: DIM-01-2P 1ch dimmer with 2-pole switching HW ID: 12 Prod: DAL-01 Dali dimmer HW ID: 14 Prod: DIM-01-LC 1ch dimmer HW ID: 15 Prod: DIM-02-LC 2ch dimmer HW ID: 17 Prod: REL-01-2P 1ch relay with 2-pole switching HW ID: 18 Prod: REL-02 2ch relay HW ID: 36 Prod: LED-75 LED dimmer C/W

SweVictor commented 1 year ago

@SM6WGG: Thanks for that list, very helpful. The plan is to do just that - add new hardware id:s as well. I just first want to verify that the plugin doesn't completely recycle/crash when it encounters unknown hardware. When that is verified I'd be happy to add more HW id:s.

Regarding the list above, there are still a few gaps (7, 9, 13, 16, 20-35), do you happen to know anything about those? Two we have listed in our code base, maybe those are not correct?

I also notice you differentiate between some models more then we do, ex DIM-01 and DIM-01-LC, could you elaborate a bit on what the difference there is?

SM6WGG commented 1 year ago

The gaps are currently not used for anything "out" there, at least not anything official. ;) REL-01 only exist as REL-01-2P so the only "REL-01" I am aware of is HWid17. Not sure about the SPR at 20 though, in my setups I only find them under HWid 8 and I have nothing showing up on 20.

It seems like there are a few beta testers out there and I guess the numbers could have been different at some point earlier in development etc.? I haven't been using Plejd devices myself more than 2-3 years. I have had most of the above setup in my api.js file at least since the 0.8.0 release without issues though. (Have about 70 devices in my 2 HA connected systems and even the slightest letter off on an entity model#/id would tick of my OCD and would have been noted and corrected by now.. lol) The "LC" models are newer hardware of the same products, (due to the component shortage or product improvement perhaps) It can be seen on the PCB naming if one open the pucks and look inside as well as them having other FW versions shown in the original app. They could obviously be listed under the same case since they are the "same thing" but like I said my OCD wouldn't approve and I'm sure there are more suffering from the same out there.. :P I haven't had the pleasure of testing/verifying any LED-75 myself but as seen above it shows up as case 36 for the beta testers so I added it as such. ;)

SweVictor commented 1 year ago

Alright, great, thanks for that. Is "LC" something Plejd came up with? As in - should we call it "LC" or maybe just "v2"?

SM6WGG commented 1 year ago

Don't think there is any official explanation, it "could" be an abbreviation though.. 😉 Naming/grouping wise and to keep the programming simple perhaps it is easier to just put them under the regular name/same case? I'll keep modding my api file to comply with my OCD as usual for sure. 😂

If you want to get the latest update/rant from the OCD list feel free to send an email instead of me filling this thread with nonsens. 😉

gust4vsson commented 1 year ago

I believe I was a beta tester of those DIM-01-LC a couple of years back and they work exactly like the regular DIM-01.

The explanation mail said they had "allocation problems" with the previous version.

I've got a weekend of hiking and shit so I'm gonna test out the updated integration on sunday.

Thanks guys.

SM6WGG commented 1 year ago

So I managed to get some testing done, for me the LED-75 works without the latest branch changes. 🤔 Only difference in my file from the standard master branch is my OCD corrected device list and that i have commented out ( // ) all lines reffering to "version:" that have given me problems before.

SweVictor commented 1 year ago

Alright, thanks. @vBrolin: Had any chance to test the test version from the branch I linked? I could go ahead and try to implement the LED-75 directly, but I would prefer if someone could check we're not crashing anymore 😄

vBrolin commented 1 year ago

I've been away, and I also moved the LED-75 to another site. I'll see what I can do, if I can find a Bluetooth dongle I might be able to test tomorrow.

mån 10 okt. 2022 kl. 16:41 skrev Victor @.***>:

Alright, thanks. @vBrolin https://github.com/vBrolin: Had any chance to test the test version from the branch I linked? I could go ahead and try to implement the LED-75 directly, but I would prefer if someone could check we're not crashing anymore 😄

— Reply to this email directly, view it on GitHub https://github.com/icanos/hassio-plejd/issues/250#issuecomment-1273421730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOCISI5RZMSSIEPQ72J4K5DWCQTJ5ANCNFSM6AAAAAAQX4YWNQ . You are receiving this because you were mentioned.Message ID: @.***>

gust4vsson commented 1 year ago

Hmmkay. Logging is set at debug. Addon did not crash. LED-75 doesnt get added to MQTT or anything though.

Managed to snatch this, reading logs from addons in HA is such a pain in the a.

"notes": "LED-75",
"data": {
  "__type": "File",
  "name": "084ba6c259a4da59ce961ccc76a92d25_application.bin",
  "url": "https://cloud.plejd.com/parse/files/zHtVqXt8k4yFyk2QGmgp48D9xZr2G94xWYnF4dak/084ba6c259a4da59ce961ccc76a92d25_application.bin"
},
"metaData": {
  "__type": "File",
  "name": "d6a622d47d58449ef7df81d53f1e73f4_application.dat",
  "url": "https://cloud.plejd.com/parse/files/zHtVqXt8k4yFyk2QGmgp48D9xZr2G94xWYnF4dak/d6a622d47d58449ef7df81d53f1e73f4_application.dat"
},
"version": "0.3.20",
"buildTime": 20220914131136,
"firmwareApi": "9",
"createdAt": "2022-09-22T14:45:10.994Z",
"updatedAt": "2022-09-22T15:05:25.719Z",
"ACL": {},
"objectId": "pHPCKaF3qG",
"__type": "Object",
"className": "Firmware"

}, "createdAt": "2022-09-29T17:52:49.465Z", "updatedAt": "2022-10-10T19:37:04.873Z", "diagnostics": "0000000000000000C70400001D00", "dirtyClock": false, "dirtyInstall": false, "dirtySettings": false, "dirtyUpdate": false, "siteId": "ab2ca10a-1dec-44ed-bc99-419e0f5b05a7", "coordinates": { "type": "GeoPoint", "latitude": 56.0873369, "longitude": 12.9133708 }, "predefinedLoad": { "loadType": "LED-75", "descriptionKey": "LED75StandardDescription", "titleKey": "LED75StandardTitle", "predefinedLoadData": "{\n \"Order\": 2,\n \"Max\": 100,\n \"AllowedMin\": 0,\n \"Start\": 1,\n \"Min\": 1,\n \"OutputSpeed\": 0.1,\n \"BootState\": \"UseLast\",\n \"OutputType\": \"LIGHT\",\n \"UserDefined\": [\n \"LoadVoltage\",\n \"SimpleStart\"\n ],\n \"Settings\": [\n \"SimpleStart\",\n \"Max\",\n \"LoadVoltage\"\n ]\n}", "defaultDimCurve": { "type": "Pointer", "className": "DimCurve", "objectId": "D4DW87HQ21" }, "createdAt": "2022-09-22T15:01:27.555Z", "updatedAt": "2022-09-22T15:14:54.025Z", "allowedDimCurves": { "type": "Relation", "className": "DimCurve" }, "ACL": { "*": { "read": true } }, "objectId": "6TP3uwu0cO", "type": "Object", "className": "PredefinedLoad" }, "ACL": {}, "objectId": "3xhtvHtzHG", "__type": "Object", "className": "PlejdDevice" }

Also, when I press a button I synced with the LED-75 this is spat out:

2022-10-10 22:11:36 DBG [plejd-ble] Unknown (null) got state update. S: 1 2022-10-10 22:11:36 WRN [device-registry] Trying to set state for null which is not in the list of known outputs. 2022-10-10 22:11:36 WRN [plejd-mqtt] Unknown output id null - not handled by us.

SweVictor commented 1 year ago

Nice finds, thanks!

Regarding debugging - once you know how to access the file system it actually gets easier to fetch logs. Look in the developing section of the readme if you're interested. You can get logs through vs code quite nicely when all is set up correctly actually

SweVictor commented 1 year ago

Alright - went through the hardware register based on new info above https://github.com/icanos/hassio-plejd/issues/250#issuecomment-1269535099

Updated branch below. Does not seem to break anything for me, I don't have the new fancy devices though. https://github.com/icanos/hassio-plejd/tree/feature/new-devices-2022-10

GWY-01 and DAL-01 are currently commented out. If anyone has a DAL-01 and has suggestions on how to implement, please open a separate issue and/or create a PR

Please, if possible, test the new branch and report back. Works on my machine :)

SM6WGG commented 1 year ago

Hmm.. not sure if im doing something wrong updates and rebuilds are usualy smooth and painless but I cant seem to install the latest branch at all. I keep getting "Unknown error, see supervisor" and looking in supervisor log i get "[supervisor.docker.addon] Invalid build environment, can't build this add-on!". Well I guess I'm stuck with my current version. ;P I love the added "description" lines!

SweVictor commented 1 year ago

Hmm, that doesn't sound promising... I'm quite a few versions behind with HA updates due to them not succeeding... That said, the latest changes in the Addon are quite minor...

Vantive1 commented 1 year ago

Hi!

Thanks for your efforts to fix this. I installed LED-75 the other week and had to reinstall the Plejd add-on, for other reasons, today. I also ended up with the following stopping error which I understand that you are working on. The Plejd ecosystem is important for me to be able to run automations for my heating system, so I'd like to hear if we are close to a new release? Is there anything I can do to help with the issue since I have the LED-75 hardware?

2023-02-05 19:16:57 INF [plejd-api] Site found matching configuration name ABC123 2023-02-05 19:16:57 INF [plejd-api] Get site details for xxx-yyyy-1111-2222-3333333333333... 2023-02-05 19:16:57 INF [plejd-api] got site details response 2023-02-05 19:16:57 INF [plejd-api] Site details for site id xxx-yyyy-1111-2222-3333333333333 found 2023-02-05 19:16:57 INF [plejd-api] Saving cached copy 2023-02-05 19:16:57 INF [plejd-api] Getting devices from site details response... 2023-02-05 19:16:57 INF [plejd-api] Plejd gateway 'Elcentralen' found on site Catastrophic error. Resetting entire addon in 1 minute Error: Unknown device type with id 36 at PlejdApi._getDeviceType (/plejd/PlejdApi.js:373:15) at /plejd/PlejdApi.js:431:61 at Array.forEach () at PlejdApi._getPlejdDevices (/plejd/PlejdApi.js:396:30) at PlejdApi.getDevices (/plejd/PlejdApi.js:225:10) at PlejdApi.init (/plejd/PlejdApi.js:81:10) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) at async PlejdAddon.init (/plejd/PlejdAddon.js:45:5) at async main (/plejd/main.js:18:5)

Otherwise, may a workaround be to uninstall LED-75 from Plejd ecosystem and then install the addon, and after that reinstall the LED-75 in Plejd again?

Again thanks!

Ulzzon commented 1 year ago

Hi, I have been running the mentioned branch https://github.com/icanos/hassio-plejd/tree/feature/new-devices-2022-10 for a few weeks and it solved the issue I experienced with LED-75. I run two LED-75 in my system and it works great with this branch, it manages dimming and control of them perfectly.

Much appreciated work!

Vantive1 commented 1 year ago

@Ulzzon Thanks for giving this feedback! Could you please help me and share how I get the suggested code to run instead of latest released version? I'm running (or was running) the add-on on Home Assistant Blue. I need help to understand what files to put where, what I need to change, etc. Thanks! 🙏

Ulzzon commented 1 year ago

@Vantive1 I followed the manual installation guide, simply git clone the branch into the /addon folder. However, had to restart it once or twice and remember to deactivate the current installation that you have.

timjackson commented 1 year ago

I have a LED-75 and can confirm the feature/new-devices-2022-10 branch is working great. The only comment I'd make is that in PlejdApi.js, the "description" property has a mistake: it calls the device a "1-channel LED dimmer/driver with tuneable white, 10 W" whereas it is in fact 75W.

@SweVictor Thanks for the update. I'd strongly encourage releasing this branch as a stable version, since (as noted in the original comment) the current release (0.9.1) fatally crashes with a LED-75 installed.

timjackson commented 1 year ago

Also: plejd/README.md needs updating to reflect LED-75 support

SweVictor commented 1 year ago

@vBrolin, @timjackson, @gust4vsson and others. I have prepared a 0.10.0 release. Please, if possibly, try that new release before we push it widely. Should resolve this issue finally.

https://github.com/icanos/hassio-plejd/pull/280

timjackson commented 1 year ago

@vBrolin Works for me

SweVictor commented 1 year ago

Solved in the upcoming 0.10.0