mongoose-os-libs / shadow

Other
5 stars 1 forks source link

Shadow in Greengrass Core doesn't work ESP32 #1

Open luclissi opened 6 years ago

luclissi commented 6 years ago

Hello, I'm trying to use the example-shadow-js the right one with AWS and it works perfectly, but when I put it in the greengrass's core, the shadow doesn't work.

When I do Shadow.update(0, {reported: {uptime: Sys.uptime()}}); the return is event: "???" and obj: {}

I've tried make with shadow subscriptions and with version 1.20 of aws lib and it works.

This is my config after discovery:

{
  "device": {
    "id": "my_thing"
  },
  "mqtt": {
    "enable": true,
    "server": "192.168.10.106:8883",
    "client_id": "my_thing",
    "ssl_cert": "certificate.pem",
    "ssl_key": "private.key",
    "ssl_ca_cert": "aws-gg-ca.pem",
    "max_qos": 0
  },
  "shadow": {
    "lib": "aws"
  },
  "aws": {
    "thing_name": "my_thing",
    "greengrass": {
      "enable": true
    }
  },
  "bt": {
    "enable": false
  },
  "wifi": {
    "sta": {
      "enable": true,
      "ssid": "why-fi",
      "pass": "passofwifi"
    },
    "ap": {
      "enable": false
    }
  }
}

Thanks! ;D

brunoasouza commented 6 years ago

I have the same problem... :(

Please help!!

supermock commented 6 years ago

I have this problem too! @rojer @cpq

mrtj commented 5 years ago

I found this thread googling "greengrass core shadow not found", so I've nothing to do with Mongoose OS. But meanwhile I found out that the shadow syncing for AWS Greengrass Core is not enabled by default and there is no way to enable it from the AWS console. An AWS CLI based solution is described in https://forums.aws.amazon.com/thread.jspa?messageID=871099, it takes the last version of the core definition, modifies it enabling shadow syncing and saves the new version so you can deploy it to the core. I coded the CLI commands into a python script to make it more easy to execute. Maybe you find it useful: https://gist.github.com/mrtj/7d25a7d0505e4158e93d8f4778f30221

ghost commented 5 years ago

I was facing a similar issue (see my reported issue https://github.com/mongoose-os-libs/aws/issues/11) I fixed it with pull request https://github.com/mongoose-os-libs/aws/pull/10

cpq commented 5 years ago

Integrated @ZenDIY 's fix. In order to work, the config must explicitly set shadow library:

config_schema:
  - ["shadow.lib", "aws"]
  ...

Update to the latest version:

mos update latest
mos build