# Modbus V2 8.0.6 RC1 zero based addressing

**URL:** <https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 1, 2019, 9:44am UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587 "2019-11-01T09:44:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [November 1, 2019, 9:44am UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587/1 "2019-11-01T09:44:08Z")

</div>

in the release notes for 8.0.6 RC1 there is:

Converted the One-Based Addressing setting in Modbus devices to Zero-Based Addressing.

Would it be possible to get some clarification on this? All Modbus devices need to have this setting inverted after the update?

edit: found this identifying it as a bug [[Bug-15335]Zero-Based Addressing](http://forum.inductiveautomation.com/t/bug-15335-zero-based-addressing/29534)

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [November 1, 2019, 11:48am UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587/2 "2019-11-01T11:48:27Z")

</div>

I just want to give anyone else an updated about what we’ve found so far:

the new setting should be called “zero based addressing”. out of ~6 servers we’ve installed this updated on, 2 of them showed the new name in the gateway under a modbus tcp device. The rest still show “one based addressing”.

Most of the devices continued to work after the update, but many did not. toggling the setting and saving fixed it.

On some of the devices that kept on working (exact same type of end device) we noticed the setting was still True, even though it should have been false to match the other ones that we got working. Changing the setting to false, and saving, let the device continue getting correct data. Changing the setting back to True however, caused it to stop working. It seems as though the setting being displayed to the user on the gateway, is not the setting it actually has configured.

We’ve also found that rebooting a server caused working devices to stop working, and we had to go and change the settings to get it working.

We also found that on some devices, we had to toggle the span gaps setting to get things working again.

Was this setting called zero-based addressing again at some point in the past? We have that as the setting in some of our modbus configuration tables.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 1, 2019, 3:56pm UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587/3 "2019-11-01T15:56:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [November 1, 2019, 3:58pm UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587/4 "2019-11-01T15:58:13Z")

</div>

damn thank you for this informative and clear explanation!

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 13, 2019, 12:25am UTC](https://forum.inductiveautomation.com/t/modbus-v2-8-0-6-rc1-zero-based-addressing/29587/5 "2019-11-13T00:25:35Z")

</div>

Is that going to fix the addDevice scripting function to set the ZeroBasedAddressing correctly?

```auto
deviceProps = {}
deviceProps["hostname"] = "192.168.1.2"
deviceProps["zeroBasedAddressing"] = False
system.device.addDevice(deviceName="TestZeroBasedFalse", deviceType="ModbusTcp", deviceProps=deviceProps)

```
