Have you tried calling Device.State? (Where device = the name of the device you are trying to get the state of)
I have called Device.State, and have PREOPERATIONAL. Calling "Device.GetDeviceState" I get CONFIGURED. This is because of one returns CANOPEN_STATE enum and the other one, DEVICE_STATE.
But I would like to reach programmatically to the additional info that appears in "Diag. String" in tab "State" when I click the Device in the device tree (in this case, "EMCY.Nodeguarding error".