Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to Setup #13

Open
Hansontech190 opened this issue Jul 25, 2023 · 48 comments
Open

Failed to Setup #13

Hansontech190 opened this issue Jul 25, 2023 · 48 comments
Labels
bug Something isn't working

Comments

@Hansontech190
Copy link

After updating to latest version I have the following:

IMG_0031

I’ve removed the integration and added again but same problem.

@sftgunner
Copy link
Owner

Ah, sorry you're hitting this! Could you have a look in logs to see if there's a more specific error message and report back if there is? https://my.home-assistant.io/redirect/logs/
If there's a lot in there, you can search for "edinplus" which should narrow it down.

@Hansontech190
Copy link
Author

Hansontech190 commented Jul 25, 2023

No problem. Here's the error log:

Logger: homeassistant.config_entries
Source: custom_components/edinplus/edinplus.py:372
Integration: eDIN+ (documentation, issues)
First occurred: 7:50:29 AM (1 occurrences)
Last logged: 7:50:29 AM

Error setting up entry 192.168.1.140 for edinplus
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/init.py", line 32, in async_setup_entry
await hub.discover(entry)
File "/config/custom_components/edinplus/edinplus.py", line 109, in discover
self.lights = await self.async_edinplus_discover_channels(config_entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/edinplus.py", line 372, in async_edinplus_discover_channels
LOGGER.warning(f"Unknown input entity of type {DEVCODE_TO_PRODNAME[input_entity['devcode']]} found as {input_entity['name']} with id {input_entity['id']}")
~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'`

@sftgunner
Copy link
Owner

Ah, that's a relief - should be an easy fix (was part of the changes to make logs more human-readable). Will push a quick fix through in v0.5.7 shortly. Many thanks!

@sftgunner
Copy link
Owner

Should be fixed in v0.5.7 - if you can give it a go and let me know if it's worked for you, that'd be much appreciated.

@Hansontech190
Copy link
Author

Thanks so much for quick response.
Unfortunately I have to report there's still an error:

Logger: homeassistant.config_entries
Source: custom_components/edinplus/edinplus.py:384
Integration: eDIN+ (documentation, issues)
First occurred: 10:25:33 AM (3 occurrences)
Last logged: 10:29:44 AM

Error setting up entry 192.168.1.140 for edinplus
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/init.py", line 32, in async_setup_entry
await hub.discover(entry)
File "/config/custom_components/edinplus/edinplus.py", line 109, in discover
self.lights = await self.async_edinplus_discover_channels(config_entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/edinplus.py", line 384, in async_edinplus_discover_channels
name=input_entity['full_name'],
~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'full_name'

Also second error in log:

Logger: custom_components.edinplus.edinplus
Source: custom_components/edinplus/edinplus.py:109
Integration: eDIN+ (documentation, issues)
First occurred: 10:25:33 AM (3 occurrences)
Last logged: 10:29:43 AM

Unknown input entity of type LCD Wall Plate found in area Master Bedroom as with id edinpluscustomuuid-28-1

However I think this is down to the integration not recognising the Mode LCD control plate? I have one of these in the system which I think is confusing it. Link to LCD plate: https://www.modelighting.com/products/evolution/controls/evo-lcd-plate/

@sftgunner
Copy link
Owner

Ah, sorry, I see what I did wrong now! In the most recent set of changes I tried to modify the code to ignore any input devices it doesn't know how to deal with (before it was blindly creating them as devices in HA that couldn't then be interacted with in any meaningful way). Will try and push a second fix and will verify a bit more thoroughly on my end before committing a release this time, sorry!

@sftgunner
Copy link
Owner

sftgunner commented Jul 25, 2023

Right, have added the missing continue statement, and have also tried removing the contact module from the supported device list while testing, and have verified that it should all work this time in v0.5.8... fingers crossed!

@Hansontech190
Copy link
Author

Thanks again. Yes that's fixed it with all lights now working I think.

It's still just switching on without the fade up/down time but not sure if that's something which you still need to implement? i.e. taking the scene from the NPU rather than $SCNRECALLX. However it could also be the config in HA as I've left everything a default when installing the integration. It's just prepopulated the cards with the lighting channels.

@Hansontech190
Copy link
Author

Another thing I've noticed is the state of the lights isn't reflected in HA if I switch on from a faceplate. The light shows off in HA even if on.

@sftgunner
Copy link
Owner

sftgunner commented Jul 25, 2023

Hmm - the lights should be updated in HA if switched on from a faceplate - I'll do some investigating on my setup to see if I can replicate/diagnose.

As for the first comment, the fade time is implemented, but it's here we run into slight issues in interoperability between HA and the NPU, and I'd certainly appreciate additional user input/feedback. Apologies for the verbosity of the below explanation, but I thought clarity was probably the priority over length!

HomeAssistant interprets lighting channels (i.e. the outputs of the DIN Dimmer modules) as physical lights in the real world, and that's what's appearing in your HA instance. These lighting channels can be interacted with using the $ChanFade command on the NPU, which is what happens by default. However, this doesn't work very well with the native NPU scenes.

For example, say I have a light output A, that has two scenes assigned to it on the NPU (scn1 = 100% brightness, scn2 = 0% brightness), with two physical buttons (btn1, btn2) set to each trigger a scene respectively. If I set light output to 100% brightness using ChanFade, and then try and toggle scn1 using btn1, nothing appears to happen, as the light is transitioning from {100% brightness, no scene active} to {100% brightness, scn1 active}. A second toggle on btn1 will then turn the light off, as expected, and a third toggle will continue as expected, turning to 100% brightness, a fourth would turn it off, and so on. The point being that ChanFade removes the light output from being associated with any particular scene, which results in an unexpected extra input required when toggling. If btn2 is set to simply recall scn2 (i.e. light output A = 0% brightness), that will work every time.

However, the NPU prefers working in terms of scenes (scn1 on, scn1 off, scn1 50%), but because two different scenes can both contain the same light output (and in the case above for scn2, can be set to 0% brightness for a given channel), I can't simply pass scenes through to HA as "lights", as the internal state monitoring inside HA isn't designed to deal with something like scn2 as a light.

My solution to this was what I call "proxy scenes". This is where you set up a scene on the NPU to only affect one channel with 100% brightness (see scenes 1, 2 and 5 in the screenshot below, and ignore the scene names, which I need to fix!). The integration will look for scenes that only have one output channel associated with them, with that output channel set to 100% for that scene (which eliminates scenes 3, 4 and 8), and instead of using ChanFade to control those lighting outputs in HomeAssistant, it uses a selection of ScnOff, ScnRecall and ScnRecallX as discussed above (i.e. using that scene as a proxy for the lighting channel). The other key benefit here is that you can assign fade times to scenes, but critically, you can't assign fade times to channels through the NPU interface, as the ChanFade command is not standard expected usage.

The interesting bit is that ChanFade does accept a fade time parameter, but it's how the fade time should be determined if there's no proxy scene that's the tricky bit - I could take the mean or mode fadetime from all scenes that the channel appears in (but this could result in odd, unintuitive behaviour depending on the setup), or I could have this as a blanket setting during configuration for all lighting channels, but then you lack the customisation that is the strength of the eDIN+ system. Obviously having it configurable for each lighting channel in HA could be an option, but as you mentioned in another comment, most people have spent ages setting up their eDIN+ system to work perfectly on the NPU, and having to go through tens of lighting channels in HA setting them all up again is far from ideal

This is why I left the ChanFade time as 0, on the basis that it probably won't result in optimal behaviour for anyone, but it's the easiest to intuitively expect and understand, with the option of setting up Proxy Scenes if you want/need the fadetimes and intuitive toggling, and the "least bad" overall in my mind, but I'm very receptive to suggestions - this was done based on the two eDIN+ setups I've come into contact with, but I'm aware there are so many different permutations and configurations that I likely haven't considered!

Screenshot 2023-07-25 at 12 18 26

@Hansontech190
Copy link
Author

Thanks for the explanation. I think you've hit the nail on the head with this comment:

< However, the NPU prefers working in terms of scenes (scn1 on, scn1 off, scn1 50%), but because two different scenes can both contain the same light output (and in the case above for scn2, can be set to 0% brightness for a given channel), I can't simply pass scenes through to HA as "lights", as the internal state monitoring inside HA isn't designed to deal with something like scn2 as a light.>

I didn't realise that HA couldn't cope with importing a scene as a light. Think that's where the problem will be as not sure how you can ever replicate the eDIN+ configuration if HA can't cope with importing a scene. I think they're be a lot of conflict due to the way eDIN+ can combine lights/channels into multiple scenes. However I think Lutron's system also does something similar but it may be implemented differently.

When you mention proxy scenes, how would this be implemented in HA? I know you can set scenes up for various scenarios but after playing with this briefly I don't think it provides the flexibility that the config already in eDIN+ has. Is that what you mean by a proxy scene?

You're also 100% correct in that everyone's configuration for eDIN+ will be different with various levels of complexity. For instance in my own setup I have various System Modes which need to be active/inactive for various scenes to activate. Overall my setup is quite complex in terms of what it controls.

Anyway if I can be of any help let me know and thanks again for all the efforts.

@jeff-heine
Copy link

Scene toggling behaviour is surprisingly full of gotchas for something that seems 'obvious'. Toggling scenes on & off needs to know the state of a scene, ie. if it is on or off. Although it seems like a simple statement, when different scenes control the same channel and you mix channel operations with scene operations the state of the scene turns out to be surpisingly difficult to define. And it turns out to be very context sensitive and subjective.

Because scene state can be so subjective, eDIN+ makes a simple rule - controlling channels and controlling scenes do not mix - stick to one or the other. So introducing proxy scenes is a good way if you use scenes and individual channels need controlling, as this has a better chance of tracking scene states. An exception is when defining or editing scenes where indvidual channels need to be adjusted. But in this case disruption to scene states is usually less important.

An example of the subjective nature of scene states is as follows. Suppose you have an All on scene for a room that includes a table lamp/bed side lamp. You recall the All on scene but then have a button that turns off the table lamp. Should the All on scene still be active/on or not? Some people think that it should not, because all the lights are not on. Other think it should still be on and essentailly the room is lit, especially if a toggle active is against the All On scene, so that a toggle of all on will turn the lights off. Often require behaviour varies from room to room, or even plate to plate within a room. It is impossible to generalise to every situation.

eDIN+ does have a number of settings for scenes that affect how the scene state is determined, but they are mostly relegated to advanced settings as this topic is a lot deeper than at face value.

@sftgunner
Copy link
Owner

Sorry for the delay @Hansontech190 - in response to your last query with proxy scenes, it's effectively a way to modify the eDIN+ configuration to make the NPU work more nicely with HA - the trick being that you set up a scene on the NPU for each channel where it's set to 100%, and then the HA integration will read that information and will then interact using those NPU scenes (which are the "proxy scenes") rather than interacting with the channels directly.

The other potential compromise could be to simply add a blanket fade time configuration option in HA - you lose the configurability, but if you have the majority of your lights on a 5 second fade time, then that could be implemented when interacting with any channels via HA. I'd need to read up on how to add that information as an option, but I'm sure it'd be possible!

In short though, not ideal, I'm afraid! You're absolutely right that HA "Scenes" are a totally different beast - the "proxy scenes" is literally just a name I came up with that is applicable to this integration and this integration only!

@Hansontech190
Copy link
Author

No apology necessary, your efforts are very much appreciated.
I’m a bit confused now, easy I know! If you setup a proxy scene on eDIN with the channel set to 100% and HA can see this, why can’t it see all the other scenes already configured? I’m obviously simplifying this too much but can HA not simply import all the currently configured scenes and use these? I’m assuming the answer is no but why can it read a scene set to 100% but not read other scenes?

Sorry for not understanding how HA integrates with eDIN+ but I’m basing my limited understanding with how I’m controlling eDIN+ outside of the app and faceplates. I’ve an app based remote which I’ve configured with the eDIN+ commands like $SCENEON and $NUDGEUP etc. I then create a trigger button within the app which simply recalls the scene number as listed on the eDIN+ configuration. All this does is recall the scene with all its settings. The problem is there’s no feedback so you can’t see from the app what state the scene is in. The eDIN+ app on the other hand shows the status of each scene but is limited in what it can do.

The above is probably no help whatsoever but I’m trying to understand why HA can’t simply recall a scene rather than integrate with a channel.

@sftgunner
Copy link
Owner

sftgunner commented Jul 30, 2023

Also no need to apologise on your side - it's certainly not the most straightforward thing!

So the fundamental part is that I could add the functionality for HA to read scenes - the discovery of them isn't the difficult part. The tricky bit is then deciding how to pass the scene through to HA in a way that HA can understand.

The problem is that HA expects certain types of device, or "entity" - lights, switches, water heaters... even more abstract stuff like "Siren", "Speech To Text", "Update" and so on (there's a full list of them on the sidebar here: https://developers.home-assistant.io/docs/core/entity). When you're writing an integration, you can only expose things to HomeAssistant as being one of these entity types (e.g. as a light, or as a switch, or as a cover etc).

Consequently when it came to designing the code that could effectively translate between eDIN+ and HomeAssistant, I had to choose a) which parts of the eDIN+ system I was exposing to HomeAssistant, and b) how I was exposing them (i.e. as what device type).

The problem lies in the fact that for what is primarily a lighting system, HA expects to interact mostly using "Light" entities - so far so good. However, the NPU expects to interact mostly using "Scenes". The difficulty lies in making these two fundamentally different concepts compatible. Scenes can be weird, and they don't reliably behave in the same way as "lights" as HA understands them - as mentioned above, you could have empty scenes, or scenes that set some lights to 100% brightness while simultaneously setting other lights to 0% brightness, or just scenes that set a bunch of lights to 0% brightness. These can't usefully be interpreted as "lights" due to the bizarre logic and incredibly confusing interface that would result in HA, not to mention that scenes can interact with other devices through the relay and I/O module!

Ok, I thought initially, no problem. If I can't use eDIN+ scenes as HA "lights", then why don't I just import the eDIN+ channels as lights, and eDIN+ scenes as HA "scenes". However... the issue here lies in the fact that HA treats "lights" as first-class citizens, and "scenes" are a lot harder to access/use... and equally eDIN+ treats "scenes" as first-class citizens, and "channels" are more of a "if you need to use them, they're there, but we'd really recommend using scene control instead".

There's also a slight issue that HA "scenes" work a bit weirdly (to me, anyway!) - you can turn them on ("activate them") using the UI or as service calls, but as far as I'm aware there's no ability to turn them off again or set to a percentage of their maximum brightness, for example - the latter of which is a key feature with dimmable fixtures in the eDIN+ system (especially with the new Oslo controls!). To make matters worse, scenes in HA aren't stored as being "on" or "off" (they're so-called stateless), so there's no way of knowing what scenes are active on the eDIN+ system by looking at HA, as there's no feedback (i.e. I'd only be able to use $SCENEON).

Consequently, I created these "proxy scenes" to try and bridge the gap to keep both HA and the NPU on the eDIN+ system as happy as possible, as you are then interacting with the preferred entity for both (eDIN+ "scenes" and HA "lights"). To make sure that these scenes work as HA is expecting, I had to enforce the 100% brightness, single channel rule - the brightness issue could probably be fixed (although it would require a bit of a re-write, as brightnesses are currently read from the channel directly, rather than the proxy scene if it exists), but the single channel requirement has to persist by the very nature of a proxy channel.

Ideally though, I'd like to add support for all eDIN+ "scenes" being imported as HA "scenes" in addition to this slightly hacky solution, to give maximum flexibility to the user, but the main issue is a lack of examples for me to draw upon - the only integrations I'm aware of that implement them in this way are the Phillips Hue, MQTT and KNX integrations, all of which are very mature and quite complex! The direct documentation available is also... not particularly detailed with no information on how to match lights to scenes as you create the scenes, for example.

Hopefully the above makes sense - I'll have a look into adding HA "scenes" - if nothing else, having the ability to trigger scenes using service calls is another good compromise solution, but the fundamental problem comes from trying to marry two systems that have slightly different design philosophies, I'm afraid.

Sorry that's a bit of a wordy message - the key answer to your question is that HA could recall a scene in addition to integrating with a channel, but the difficulty is what HA entity you use to trigger that command. I think using a HA scene or HA service call to trigger the eDIN+ scene recall would make the most sense, and the latter has been on my "I really should look into adding this" list for a while, but my immediate priorities are validating and adding full support for the keypad, I/O module and Relay modules, all of which have been recently added to my test setup.

@Hansontech190
Copy link
Author

Really appreciate that explanation and taking the time to explain.

That all makes sense and I can now see the problems! Lighting control systems can get very complex and Mode Lighting have resisted altering the original software interface for some time due to that. eDIN was always designed as a much simpler control system than Evolution but I understand they decided to completely redesign the backend Gateway when they released eDIN+. However this then makes integration difficult for the developer.

So in essence, if total control of eDIN+ was needed in HA, a proxy seen would have to be created for each lighting channel and this set to 100% - is that correct? What about the I/O channels and Relay Channels, do these also need a proxy scene? The relay channels should be relatively straight forward as these are simple switches, on or off. I/O channels may be a bit more complex as these can be simple contact inputs or PIR inputs.

Thanks again for your time.

@sftgunner
Copy link
Owner

That is correct - a proxy scene would need to be created for each lighting channel and set to 100% - I'm aware this is a bit of a pain!
I/O channels and Relay channels still need to be implemented properly - I haven't got a Mode PIR for the system (part of the incentive behind creating the integration was so I could use EP1s instead as they have both PIR and mmWave sensors onboard), so that could be a little difficult to code for, but the relay channels should hopefully be straightforward enough, and I hope to have them implemented properly without the need for proxy scenes or the like soon.

I/O module contact inputs should already work as expected, and 0-10V output should also work just like a normal dimmable light at the moment (i.e. needing a Proxy Scene to work with fading).

@Hansontech190
Copy link
Author

Perfect many thanks. I'll make some time and build those proxy scenes. It shouldn't take too long as the number of channels I have on dimmer modules is only around 38 or so.

Is there a recommended naming convention which would help for the proxy scenes or should they be named simply with the light they control - eDIN used to recommend naming scenes by area:light but have moved away from that now.

@sftgunner
Copy link
Owner

sftgunner commented Jul 31, 2023

The naming scheme shouldn't matter - the integration will read the name from the Channel, not the scene, if that makes sense, so whatever makes the most intuitive sense to you would be what I advise. You'll notice in the screenshot above half of the scenes in my test system are still unnamed!

If I were you, I'd recommend creating a couple of those scenes and then checking they work properly in HA (you might need to reload the integration first) before proceeding with all 38 - do let me know if you hit any issues or they don't work as expected.

@Hansontech190
Copy link
Author

Thanks again. Just had a quick play with two channels and they're working fine and feedback appears to work too. However the fade up/down time is set at zero so the channel/proxy scene comes on immediately. I think you mentioned this may be an issue previously - sorry I've lost track of where we got to with fade times. I have the default fade time set to 5s within eDIN defaults and the two new proxy scenes are set to 5s also - see attached.
I think you mentioned needing to work on that but wasn't sure whether the proxy scene fade time should be read by HA or not??

Screenshot 2023-07-31 at 16 19 30 Screenshot 2023-07-31 at 16 18 46

@sftgunner
Copy link
Owner

Hmm... the fade times definitely should be read by HomeAssistant - they'll read the scene fade times (as there's no obvious way to programatically access the default recall time in any case!).
I've got these working on my setup, but probably easier to troubleshoot why they're not working as intended on yours once I've finished/released v0.6.0 as I've had to make a few changes to the proxy scene code anyway - I'm hoping by end of week at latest, and hopefully much sooner.
Just as a heads up, I've had to change the unique identifier for channels/devices in v0.6.0, which means you'll have to reassign any devices currently used in HA automations, so I'd hold off on integrating into many automations if you haven't already!

@Hansontech190
Copy link
Author

No problem and thanks for the updates. I experimented with changing the fade time in the proxy scene but this having no effect when I switch on/off in HA.
I'll wait for v0.6.0 to experiment further.

@sftgunner
Copy link
Owner

Good to know - I would guess that it's not matching the proxy scenes correctly, so I'll make sure that the debug logs are nice and verbose for that bit of the code before release! Functionality has all been added for v0.6.0; I'll do final tests tomorrow (Friday) and should be then good to go for the weekend, all being well.

@Hansontech190
Copy link
Author

Apologies for late reply, I've been busy with work!

I'll have a play with the new release and let you know how I get on.

Thanks again.

@Hansontech190
Copy link
Author

Oh dear failed at first hurdle.

After updating I restarted HA and removed existing NPUs and then added again. However get the failed to setup error. Have shown error log below:

`This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/edinplus/edinplus.py:428
Integration: eDIN+ (documentation, issues)
First occurred: 10:01:09 AM (4 occurrences)
Last logged: 10:04:47 AM

Error setting up entry 192.168.1.181 for edinplus
Error setting up entry 192.168.1.140 for edinplus
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/init.py", line 32, in async_setup_entry
await hub.discover(entry)
File "/config/custom_components/edinplus/edinplus.py", line 113, in discover
self.lights,self.switches,self.buttons,self.binary_sensors = await self.async_edinplus_discover_channels(config_entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/edinplus.py", line 428, in async_edinplus_discover_channels
plate_name = plate_info[0][1]
~~~~~~~~~~^^^
IndexError: list index out of range
`

@sftgunner
Copy link
Owner

Sorry for the delayed response - I've been away from my test setup for a while. Just to check, does your wall plate have a name in eDIN+? I't looks like the problem is somewhere in the naming of the wall plate entities, but I'm not able to replicate the error with my own set up, either with a name for the wall plate or without... (see example below without a name)
Screenshot 2023-08-16 at 15 46 27

sftgunner added a commit that referenced this issue Aug 16, 2023
Small changes to help troubleshoot #13
@sftgunner
Copy link
Owner

I've pushed v0.6.2 to try and help troubleshoot the issue going forward, and hopefully should get your HA integration back up and running again

@Hansontech190
Copy link
Author

Hi. Just installed update but same error.

`This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/edinplus/edinplus.py:433
Integration: eDIN+ (documentation, issues)
First occurred: 7:58:51 AM (3 occurrences)
Last logged: 8:17:25 AM

Error setting up entry 192.168.1.140 for edinplus
Traceback (most recent call last):
File "/config/custom_components/edinplus/edinplus.py", line 429, in async_edinplus_discover_channels
plate_name = plate_info[0][1]
~~~~~~~~~~^^^
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/init.py", line 32, in async_setup_entry
await hub.discover(entry)
File "/config/custom_components/edinplus/edinplus.py", line 113, in discover
self.lights,self.switches,self.buttons,self.binary_sensors = await self.async_edinplus_discover_channels(config_entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/edinplus/edinplus.py", line 433, in async_edinplus_discover_channels
LOGGER.warning(plate_info[0])
~~~~~~~~~~^^^
IndexError: list index out of range
`

To answer your query all the plates are named but I have one LCD plate and the rest are old SGP plates. Didn’t get this error on your earlier versions - not sure if that helps!?

Let me know if you need anything else to debug.

@sftgunner
Copy link
Owner

sftgunner commented Aug 17, 2023

Hmm - sorry about that!

The LCD plate and SGP plates weren't properly supported before 0.6.0, which is why this error has appeared now, but I'm slightly confused as to why the regex to get wall plate information isn't working - I'll do some more investigation and will get back to you.

@Hansontech190
Copy link
Author

Not a problem.

It probably won’t help but happy to give you a copy of my eDIN config file. I know you don’t have the same hardware but if it helps let me know.

All the Best,

Andy

@sftgunner
Copy link
Owner

Much appreciated! The easiest thing to troubleshoot would be a copy of your "Names CSV" file - you can download it by going to "http://NPU_IP/info?what=names". I'm sure there's something very obvious I'm missing; I'm just going through the eDIN+ documentation now to see if I can figure out what it is, but a copy of your Names CSV would certainly speed up the process, if you're able

@Hansontech190
Copy link
Author

Have hopefully attached. Good luck!
names.csv

@sftgunner
Copy link
Owner

sftgunner commented Aug 17, 2023

Ah, I was right, it was a really stupid mistake - the regex would only match for wall plates located in areas 1-9 (i.e. it would only match if the room number had a single digit, rather than the room number being of any length) - just a case of a missing "+"!
Just going through now to see if I've missed anything else similar while I'm here, and will have a fix in 0.6.3 for you shortly. Very many thanks for your patience and help!

@sftgunner
Copy link
Owner

Have pushed 0.6.3 with the bug fix - fingers crossed this does the trick!

@Hansontech190
Copy link
Author

Thanks for the update. That’s sorted the issue.

However the fade time is back to immediate instead of the set fade up/down. I’ll have to make sure I’ve added the correct proxy scene but I haven’t changed anything since adding two test proxy scenes and these are set to 100% and 5s fade time. However when activating in HA they immediately go to 100%.

This may be my mistake but I need more time to investigate. Just wanted to let you know that no errors now produced by HA. :)

@sftgunner
Copy link
Owner

sftgunner commented Aug 17, 2023

Ah, I had a horrible feeling this might be the case. By way of troubleshooting, if you look in the HA logs, can you see if it's completing the proxy scene mapping correctly? You're looking for something that looks a bit like this:

2023-08-17 12:31:35.368 DEBUG (MainThread) [custom_components.edinplus.edinplus] Have completed channel to scene proxy mapping (using v2):
2023-08-17 12:31:35.369 DEBUG (MainThread) [custom_components.edinplus.edinplus] {'001-001': 1, '005-001': 3}
2023-08-17 12:31:35.369 DEBUG (MainThread) [custom_components.edinplus.edinplus] Have also found default fadetimes for scene proxy mapping:
2023-08-17 12:31:35.369 DEBUG (MainThread) [custom_components.edinplus.edinplus] {'001-001': 3000, '005-001': 1000}

If you go to "Load full logs" when on the log page, it should be reasonably close to the top (just after a load of entries saying "Input entity found..." and "Creating device in registry...".

@sftgunner
Copy link
Owner

You'll need to enable debug logs to get those messages - I think there might be a way of doing this via the GUI now, but I've always done it by adding the following to my configuration.yaml file:

logger:
  default: warning
  logs:
    custom_components.edinplus: debug

@Hansontech190
Copy link
Author

Thanks for the replies and apologies for delay but just getting some time to look at this.

Doesn't look like it's mapping the proxy scenes. It seems to be using the normal scene numbers (I've setup proxy scenes for just two channels - Kitchen Ceiling & Kitchen Dining which have scene numbers of 211 & 212). However the original scenes for these areas appear to be what the integration is using and not mapping the proxy scenes.

Any ideas?

2023-08-20 11:50:05.343 DEBUG (MainThread) [custom_components.edinplus.edinplus] Keeping TCP connection alive 2023-08-20 11:50:05.343 DEBUG (MainThread) [custom_components.edinplus.edinplus] Locking reads and cancelling continuous task 2023-08-20 11:50:05.344 DEBUG (MainThread) [custom_components.edinplus.edinplus] TCP TX: '$OK;' 2023-08-20 11:50:05.360 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] Acknowledge: !OK; 2023-08-20 11:50:05.360 DEBUG (MainThread) [custom_components.edinplus.edinplus] Unlocking reads 2023-08-20 11:58:54.766 DEBUG (MainThread) [custom_components.edinplus.edinplus] TCP TX: '$ChanFade,7,12,6,255,0;' 2023-08-20 11:58:54.775 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] NPU acknowledgement: !OK,CHANFADE,007,012,006,255,00000000; 2023-08-20 11:58:54.783 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] Chanfade/level recieved on TCP channel: !CHANFADE,007,012,006,255,00000000; 2023-08-20 11:58:54.793 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] NPU confirmed scene 00108 has been set to 100% of max scene brightness 2023-08-20 11:58:54.804 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] !UNKNOWN TCP RX: !BTNCOLR,033,002,001,003; 2023-08-20 11:59:03.850 DEBUG (MainThread) [custom_components.edinplus.edinplus] TCP TX: '$ChanFade,7,12,6,0,0;' 2023-08-20 11:59:03.857 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] NPU acknowledgement: !OK,CHANFADE,007,012,006,000,00000000; 2023-08-20 11:59:03.865 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] Chanfade/level recieved on TCP channel: !CHANFADE,007,012,006,000,00000000; 2023-08-20 11:59:03.877 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] NPU confirmed scene 00108 has been set to 0% of max scene brightness 2023-08-20 11:59:03.887 DEBUG (MainThread) [custom_components.edinplus.edinplus] [192.168.1.140] !UNKNOWN TCP RX: !BTNCOLR,033,002,001,004;

@sftgunner
Copy link
Owner

Ah, I think I might have found the error - very similar as before (turns out it's very easy to make a typo on regexes that very easily go un-noticed!). I'll try pushing the change in v0.6.4 tomorrow morning, but in the event that it still doesn't work, would you be able to repeat the above process that we did for the names CSV file, but this time with the levels endpoint instead? (http://192.168.1.140/info?what=levels)
In theory I can then run the proxy scenes function using your config and try and troubleshoot that way, if you'd be happy to do so!
Fingers crossed sorting the regex bug fixes it though - will update this issue with a message when v0.6.4 is live.
Very many thanks as ever for putting up with such a long, drawn-out troubleshooting process - your help is really invaluable to make sure that the integration works as well as possible, especially for larger setups than my own.

@sftgunner
Copy link
Owner

v0.6.4 is now downloadable!

@Hansontech190
Copy link
Author

Just installed and tested. All working as it should!! Many thanks for the perseverance!

In case you want it I've attached the levels endpoint file. Hope it helps.

I need to create proxy scenes for the rest of my installation but that might need some time put aside to complete!
levels.csv

@Hansontech190
Copy link
Author

Hansontech190 commented Aug 23, 2023

I am just trying to add some more proxy scenes to eDIN and also configure HA for the lights. Having a few issues!

As an example, I have setup HA to switch on/off the kitchen plinth lights by using the entity light.kitchen_plinth_lights. However on activating this light in HA it's actually recalling an eDIN scene "Mood" which is set for the kitchen and switching on 3 different kitchen lights (plinth, downlights & wall lights).

I've also setup a proxy scene for the kitchen wall lights at 100% but not sure how long this takes to populate into HA - do I need to refresh anything to get this to register as a new entity in HA? At present there's only one entity for the wall lights showing and this is coming on 100% at 0s fade and not the fade time set for the proxy scene.

@sftgunner
Copy link
Owner

Hmm. Will have a look into the kitchen_plinth_lights - should be straightforward to find the issue with the levels file, many thanks for attaching!
At the moment, you have to manually tell the integration to try and reload the proxy scenes - you do this by clicking the vertical three buttons and then selecting "Reload" next to your eDIN+ entry in HA. I've noticed that reloading frequently can cause issues with the TCP connection to the NPU - if you hit reliability issues then rebooting HA in its entirety normally fixes it for me. Certainly having it auto-scan for changes is on my list of things to add!

@sftgunner
Copy link
Owner

Ah, yet another bug in my regex - shall push a fix shortly!

Also, as an FYI it's worth nothing that for proxy scenes you only need an "on" scene for each channel, rather than both an "on" and "off" scene (although I suspect that having both comes in useful for other use cases!).

@sftgunner
Copy link
Owner

Fix has been pushed in v0.6.5 - please let me know if you have any luck... fingers crossed!

@Hansontech190
Copy link
Author

Hi,

Thanks for the update. I really hate to bring more bad news, but the new version hasn't picked up the new proxy scenes and has lost the previous ones it had with the lights resorting back to no fade time - sorry!

The plinth lights is also still running the Mood scene from eDIN+ and not just switching the plinth lights on/off.

I updated the integration and restarted HA so it should have refreshed the entities.

I've attached the names file again with the updated proxy scenes I created. The comment about only needing an ON scene is noted but, as you pointed out, I had the off scene created within eDIN for other scenarios. I've also added the new levels file hoping it helps.

Just in case this is a problem I've caused, is there a specific naming convention for the proxy scene? I've named them with 100% after the name just to differentiate from other scenes within eDIN+. I'm wondering whether that's causing a problem with the integration not recognising it as a proxy scene?

names.csv
levels.csv

@sftgunner
Copy link
Owner

sftgunner commented Sep 16, 2023

Hi there, I'm so sorry to have let this slide for so long; have had a pretty hectic month or so. I've had a quick look and the issue is a bit obvious in hindsight - the code will only match for alphanumeric names, so the "%" character is throwing it off. I'll fix the regex when I have a moment, but thought I'd let you know so you've got a way of fixing your end (i.e. substitute or remove the % character from the scene name), if you hadn't already worked it out!

@Hansontech190
Copy link
Author

Hi, no apology necessary.

Yes removing the % sign has solved the issue for now. Many thanks for that information.

These integrations are never easy, especially given the nature of eDIN+!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants