can you use the recipe variable {iot:thingName} in the merge update for the shadow manager?

0

The documentation is a bit confusing:

Merge Configuration Update says you can use the the {iot:thingName} variable.

I have tried using it in the merge update for the Shadow Manager.

{
	"strategy": {
		"type": "realTime",
		"delay": 300
	},
	"synchronize": {
		"shadowDocumentsMap": {
			"{iot:thingName}": {
				"classic": true,
				"namedShadows": [
					"test-plugin",
					"notifications-plugin"
				]
			}
		},
		"direction": "betweenDeviceAndCloud"
	},
	"rateLimits": {
		"maxOutboundSyncUpdatesPerSecond": 100,
		"maxTotalLocalRequestsRate": 200,
		"maxLocalRequestsPerSecondPerThing": 20
	},
	"shadowDocumentSizeLimitBytes": 8192
}

When I deploy it I get an error:

2023-08-11T05:29:42.430Z [WARN] (Serialized listener processor) com.aws.greengrass.shadowmanager.ShadowManager: service-invalid-state-error. Invalid reported state. {serviceName=aws.greengrass.ShadowManager, currentState=ERRORED, newState=ERRORED}
2023-08-11T05:29:42.435Z [ERROR] (Serialized listener processor) com.aws.greengrass.shadowmanager.ShadowManager: service-errored. {serviceName=aws.greengrass.ShadowManager, currentState=ERRORED}
com.aws.greengrass.shadowmanager.exception.InvalidRequestParametersException: ThingName must match pattern [a-zA-Z0-9:_-]+
        at com.aws.greengrass.shadowmanager.util.Validator.validateThingName(Validator.java:86)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.processThingShadowSyncConfiguration(ShadowSyncConfiguration.java:225)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.processThingConfiguration(ShadowSyncConfiguration.java:165)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.lambda$processOtherThingConfigurations$0(ShadowSyncConfiguration.java:107)
        at java.base/java.util.TreeMap.forEach(TreeMap.java:1002)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.lambda$processOtherThingConfigurations$1(ShadowSyncConfiguration.java:106)
        at java.base/java.util.Map.computeIfPresent(Map.java:1079)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.processOtherThingConfigurations(ShadowSyncConfiguration.java:102)
        at com.aws.greengrass.shadowmanager.model.configuration.ShadowSyncConfiguration.processConfiguration(ShadowSyncConfiguration.java:79)
        at com.aws.greengrass.shadowmanager.ShadowManager.configureSynchronization(ShadowManager.java:298)
        at com.aws.greengrass.shadowmanager.ShadowManager.lambda$install$5(ShadowManager.java:251)
        at com.aws.greengrass.config.Topics.childChanged(Topics.java:439)
        at com.aws.greengrass.config.Topics.childChanged(Topics.java:461)
        at com.aws.greengrass.config.Topics.childChanged(Topics.java:461)
        at com.aws.greengrass.config.Topics.childChanged(Topics.java:461)
        at com.aws.greengrass.config.Topic.fire(Topic.java:283)
        at com.aws.greengrass.config.Topic.lambda$withNewerValue$0(Topic.java:255)
        at com.aws.greengrass.dependency.Context$1.run(Context.java:68)

2023-08-11T05:29:42.436Z [WARN] (Serialized listener processor) com.aws.greengrass.shadowmanager.ShadowManager: service-invalid-state-error. Invalid reported state. {serviceName=aws.greengrass.ShadowManager, currentState=ERRORED, newState=ERRORED}

Basically I want to complete a deployment on all my core Devices (100+) and it should just sync the shadows that are associated with that core device and not the others.... Is this possible or do we need to explicitly list the thingName?

asked 9 months ago195 views
1 Answer
0
Accepted Answer

Hi Phil. Not sure if I misunderstand, but wouldn't you just use the coreThing specifier to sync shadows for your particular Greengrass core device? The shadowDocumentsMap is when you want to synchronize shadows for other things/devices.

profile pictureAWS
EXPERT
Greg_B
answered 9 months ago
AWS
EXPERT
reviewed 9 months ago
  • ahhhh I see, I kept over looking that, I assumed it was a placeholder for the thingName in the documentation and not refering to the actual coreThing.

    but this should work I guess?

    { "reset": [ "" ], "merge": { "strategy": { "type": "realTime" }, "synchronize": { "coreThing": { "classic": true, "namedShadows": [ "test-plugin", "notifications-plugin" ] }, "direction": "betweenDeviceAndCloud" } } }

    Thanks

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions