You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The configured maximum number of device types _maxDevicesTypesNb doesn't represent the actual maximum of device types you can add. The exact number of devices is always one less than the configured value.
Root of the bug:
The condition that checks if it is possible to add more devices is incorrect.
Let's say I want only 1 device type, so I pass maxDevicesTypesNb = 1 to the HAMqtt's constructor. Then I won't be able to add the device due to the incorrect if-check above. 0 + 1 >= 1 => true. The same is true for other numbers, having a maximum set to 7, you can add only 6 devices.
The text was updated successfully, but these errors were encountered:
The bug:
The configured maximum number of device types
_maxDevicesTypesNb
doesn't represent the actual maximum of device types you can add. The exact number of devices is always one less than the configured value.Root of the bug:
The condition that checks if it is possible to add more devices is incorrect.
The condition:
arduino-home-assistant/src/HAMqtt.cpp
Lines 188 to 190 in 0fc32a5
Initial values:
arduino-home-assistant/src/HAMqtt.cpp
Lines 21 to 23 in 0fc32a5
Simple example to understand why it's incorrect
Let's say I want only 1 device type, so I pass
maxDevicesTypesNb = 1
to theHAMqtt
's constructor. Then I won't be able to add the device due to the incorrect if-check above.0 + 1 >= 1
=>true
. The same is true for other numbers, having a maximum set to 7, you can add only 6 devices.The text was updated successfully, but these errors were encountered: