Giter Club home page Giter Club logo

mqtt_smartapp's Issues

Incoming MQTT

Thanks for your contribution @toddaustin07. This is exactly what i need in my environment!
I was wondering if you would be able to expand on the smartapp so that it can accept incoming MQTT messages so that the state of devices in smartthings can be updated.

Posible bug

Apologies, I have now lost the log sigh However, my environment gave a log error trying to publish a message where the value was supposed to be a string or buffer and was in fact a number (It was a valid reading, but it might not be a smartthings proper sensor reading - don't ask -:) )

I changed the following code in your sendMQTT Function in mqttout.js to guard this and it seems to have worked

Your code line 220
mqttClient.publish(topic, msg_tosend.event.value, pub_options, (err) => {

My change
const valToSend = (typeof(msg_tosend.event.value) == "number") ? Number(msg_tosend.event.value).toString() : msg_tosend.event.value; mqttClient.publish(topic, valToSend, pub_options, (err) => {

Unrecognized App ID

I keep getting the error that my app ID is unrecognized. I have triple checked the app id in smartthings and it matches my app id that is in config.json. Any help would be appreciated.

smartapps.js output:
pi@framboostaart:~/smartthings/smartapps/MQTT_SmartApp $ node smartapps.js

Sat Jan 20 2024 13:25:17 Listening for SmartApp messages at 8083

Sat Jan 20 2024 13:25:27 HTTP POST received: CONFIGURATION for App ID f1ba33f5-1fb0-4e14-a32c-b8fd3351213c

POST message in ngrok:
{
"lifecycle": "CONFIGURATION",
"executionId": "397b0198-44b9-dee6-f649-2f2df8c9194f",
"appId": "f1ba33f5-1fb0-4e14-a32c-b8fd3351213c",
"locale": "en-gb",
"version": "0.1.0",
"client": {
"os": "android",
"version": "1.8.12.21",
"language": "en-GB",
"displayMode": "LIGHT",
"timeZoneOffset": "",
"supportedTemplates": [],
"samsungAccountId": "",
"mobileDeviceId": ""
},
"configurationData": {
"installedAppId": "6e8cc8c5-67d9-44d5-a043-b2e63625a1b5",
"phase": "INITIALIZE",
"pageId": "",
"previousPageId": "",
"config": {}
},
"settings": {}
}

common.mylog is not a function

I'm trying to run the smartapps.js and I'm getting
Error: Cannot find module './common'
If I edit the file to require 'common' (without the./) I get
TypeError: common.mylog is not a function

I do have common installed

pi@mabpi:~/development/smartthings $ npm list
pi@ /home/pi
├── @smartthings/[email protected]
├── [email protected]
└── [email protected]

Any help would be appreciated. Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.