Closed jschmer closed 8 years ago
Repository health decreased by 0.00% when pulling 7c8261a on jschmer:ChannelIndex into 604f273 on LarsMichelsen:master.
Hi, thanks for your pull request. I applied it, but had to change it back to something more specific to keep the calling interface consistent. See my commit for details.
Hi, first let me thank you for your nice work! I'm trying to contribute to this project with my HomeMatic setup. I'm working on Windows and tried to run the basic 'list all devices and channels with their values' scenario.
I found that some devices don't have continues channel numbers, for example the device HM-TC-IT-WM-W-EU: Kanaltyp Kanalnummer WEATHER_TRANSMIT 1 THERMALCONTROL_TRANSMIT 2 WINDOW_SWITCH_RECEIVER 3 REMOTECONTROL_RECEIVER 6 SWITCH_TRANSMIT 7
Channels 4-5 don't exist for this device. This is a problem because the code at https://github.com/LarsMichelsen/pmatic/blob/604f2736daeadf98930e1c8888cf09d1e967e2ad/pmatic/entities.py#L182 assumes that all channels have continues indices, e.g. channel index equals array index. Later on this will fail because when accessing the channel index 6 for this device it will fail because the array will contain only 5 channels.
Solution would be to store the channels in a dictionary with the channel numbers/index as key.