Modbus V2 8.0.6 RC1 zero based addressing

So, some backstory - hopefully this helps clarify behavior.
First, for context:
The setting has always been called ‘zero based addressing’ internally - so the column in the internal DB is zero based addressing, the internal Java classes refer to it as zero based addressing, the system.device.addDevice function called it zeroBasedAddressing, etc. So, we wanted to “fix” the behavior of the setting to align with what the code actually expects.

The actual changes made internally in that referenced changelog did, basically three things:

  1. Changed the appearance of the setting from ‘One Based Addressing’ to ‘Zero Based Addressing’.
  2. Toggled all existing settings on upgrade - so if you had the ‘One Based Addressing’ setting one way, it would be switched to ‘Zero Based Addressing’ (that is, the value of the record in the internal db would be flipped) [1]
  3. Change the behavior of the actual drivers to use the new setting correctly - even though it’s always been called “zero based addressing” in our code, the drivers were using the setting as one-based addressing (hence, that’s what we displayed to you as a user).

So, what’s the deal, and why is stuff acting so weird?
Well, footnote 1 on item 2 is essentially: On the first gateway startup, any existing modbus drivers would start before the change was made to the internal database. As a result, any Modbus connections would have the old setting value, but the new behavior - resulting in things not working.
Any change that made the driver restart, without changing the setting values (edit -> save with no changes, or restarting the modbus driver, or restarting the entire gateway) would get your devices back into a working state. Changing the setting manually should never be necessary.

The other complication here is that ‘rolling back’ to 8.0.5, if your gateway backup was upgraded to 8.0.6RC1, will not get things working, because the setting value in all your modbus drivers will still have been flipped.

The good news is that since someone else already ran into this and reported it, I’ve already got a fix up and it’ll be in 8.0.6 final - basically, the logic to upgrade the setting runs immediately on module startup, before any drivers have started, now.

2 Likes