Hello everyone,
I’m trying to integrate a Thing from AWS IoT into Smartthings.
I’m almost there, my Thing is added to Smartthings but I am not able to update the Capability value.
My thing is a custom made Arduino project, and I monitor my swimming pool temperature, PH level and ORP value. Those values are sent to AWS.
Here is my setup:
-
I have a Smartthings Schema Connector Project:
-
The project is setup as an AWS Lambda, and all Device Cloud credentials are working fine.
-
Also in this ST project, I have a Device Profile:
and I added a standard Temperature Measurement capability:
-
My ST project is deployed to test and I can add the device in Smartthings.
-
Here is my Lambda function code:
const { lambda } = require("st-schema"); async function discoveryRequest(request, response) { console.log('discoveryRequest', JSON.stringify(request,null,2)); response.addDevice('PoolBoy-0001', 'PoolBoy', '951c7b9e-60a8-4ce5-97e0-35588731ccd8') .manufacturerName('Charles de la Sablonnière') .modelName("PoolBoy Home Made") .roomName('Backyard'); } async function stateRefreshRequest(request, response) { console.log("stateRefreshRequest: ", JSON.stringify(request,null,2)); response.addDevice('PoolBoy-0001', [ { component: 'main', capability: 'st.temperature', attribute: 'temperature', value: 32.5 } ]); } async function commandRequest(request, response) { console.log('commandRequest', JSON.stringify(request,null,2)); } module.exports.handler = lambda({ discoveryRequest, commandRequest, stateRefreshRequest });
-
The stateRefreshRequest function is called, I can see this in AWS CloudWatch logs:
2020-08-06T07:21:26.845Z b0b71cd0-7972-4b31-915d-3e07f8c17bc1 INFO response back to SmartThings { "headers": { "schema": "st-schema", "version": "1.0", "interactionType": "stateRefreshResponse", "requestId": "60617cac-125c-527d-8c59-2b09a3ea0106" }, "deviceState": [ { "externalDeviceId": "PoolBoy-0001", "states": [ { "component": "main", "capability": "st.temperature", "attribute": "temperature", "value": 32.5 } ] } ] }
The problem is, I never see the temperature value display “32.5” in the Smartthings app. It is always “0”
Anyone can help me with that? What am I doing wrong?
Thanks for your help,
Charles