Hi,
I am implementing a python based greengrassv2 script that is updating a Named Shadow on the IOT thing. My script is able to update the device shadow as expected with a basic json based string from the examples. However, when I try to update the device shadow with a slight more complex json structure the follow code throws an InvalidArgumentsError. If I manually paste in the jsons thing into the AWS console it updates fine.
# retrieve the UpdateThingShadow response after sending the request to the IPC server
op = ipc_client.new_update_thing_shadow()
op.activate(update_thing_shadow_request)
Here is the slightly more complex json structure that causes the update_thing_shadow_request to throw the InvalidArgumentsError.
Any ideas what could be the issue? I dont have much flexibility with the structure as it comes from the CSA standard for matter. I am trying to implement named shadows to hold device state information for devices that use the matter smart home standard. The json data structure is set by the connectivity standard alliance CSA
{ "state": { "reported": { "0": { "GeneralDiagnostics": { "GeneralDiagnostics.DataVersion": 2765750396, "NetworkInterfaces": [ { "name": "docker0", "isOperational": false, "offPremiseServicesReachableIPv4": {}, "offPremiseServicesReachableIPv6": {}, "hardwareAddress": "02428a9277b4", "IPv4Addresses": [ "ac110001" ], "IPv6Addresses": [ "" ], "type": 0 }, { "name": "wlo1", "isOperational": true, "offPremiseServicesReachableIPv4": {}, "offPremiseServicesReachableIPv6": {}, "hardwareAddress": "142d27de389b", "IPv4Addresses": [ "c0a80088" ], "IPv6Addresses": [ "2a02808481a2b900464020a0eb11f9d7", "2a02808481a2b900afa9aa386c61107e", "fe80000000000000cbd7a0f35f43e4fa" ], "type": 1 }, { "name": "eno1", "isOperational": false, "offPremiseServicesReachableIPv4": {}, "offPremiseServicesReachableIPv6": {}, "hardwareAddress": "6cc217716cb7", "IPv4Addresses": [], "IPv6Addresses": [], "type": 2 }, { "name": "lo", "isOperational": true, "offPremiseServicesReachableIPv4": {}, "offPremiseServicesReachableIPv6": {}, "hardwareAddress": "000000000000", "IPv4Addresses": [ "7f000001" ], "IPv6Addresses": [ "00000000000000000000000000000001" ], "type": 0 } ], "RebootCount": 1, "UpTime": 101, "TotalOperationalHours": 0, "BootReason": 0, "ActiveHardwareFaults": [], "ActiveRadioFaults": [], "ActiveNetworkFaults": [], "TestEventTriggersEnabled": false, "FeatureMap": 0, "ClusterRevision": 1, "GeneratedCommandList": [], "AcceptedCommandList": [ 0 ], "EventList": [ 0, 1, 2, 3 ], "AttributeList": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 65528, 65529, 65530, 65531, 65532, 65533 ] } } } } }
Any advice or help would be greatly appreciated
Thanks Massimiliano,
I appreciate your quick reply. I have noticed that my implementation uses
client = awsiot.greengrasscoreipc.connect()
While your implementation example uses
client = GreengrassCoreIPCClientV2()
I went ahead and changed the client to the V2 client but I still get the issue. I got my implementation working by reducing the depth of the shadow document by changing some of the deepest fields to strings. For example
Changing "IPv6Addresses": [ "2a02808481a2b900464020a0eb11f9d7", "2a02808481a2b900afa9aa386c61107e", "fe80000000000000cbd7a0f35f43e4fa" ]
To
"IPv6Addresses": "[ 2a02808481a2b900464020a0eb11f9d7, 2a02808481a2b900afa9aa386c61107e, fe80000000000000cbd7a0f35f43e4fa ]"
But I dont want to alter the underlying structure too much as its the defined structure as per the Matter CSA specification v1.0.
When I get the error, here are the logs that show what happening.
2023-02-14T07:33:30.965Z [WARN] (Copier) MCCDev-mcc-daemon: stderr. return self.__get_result(). {scriptName=services.MCCDev-mcc-daemon.lifecycle.Run.script, serviceName=MCCDev-mcc-daemon, currentState=RUNNING} 2023-02-14T07:33:30.965Z [WARN] (Copier) MCCDev-mcc-daemon: stderr. File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result. {scriptName=services.MCCDev-mcc-daemon.lifecycle.Run.script, serviceName=MCCDev-mcc-daemon, currentState=RUNNING} 2023-02-14T07:33:30.966Z [WARN] (Copier) MCCDev-mcc-daemon: stderr. raise self._exception. {scriptName=services.MCCDe