[Demonstration Code] QR Data to Hub

Was playing around with Claude.ai and had it generate some code to read QR codes. Since I had the HTML and JS I thought, why not grab the data and send it to the hub. So long story short there are 3 files - 1 app (qrToHub.groovy), 1 html (qrReader.htm) and 1 js (qrRdr.js) - located at hubitat/qrReader at main · thebearmay/hubitat · GitHub. App goes into the App Code section (with OAuth enabled), the other 2 files go into the File Manager.

App will pass it's key to the HTML file and open it using https (required for iOS - just ignore the error message if you get one and proceed). The HTML code will allow you to use the camera, upload an image of the QR Code or copy/paste the QR. Once it has it, it will display the content and give you a button to send the content to the hub. After you click the button go back to the app and refresh - it should be displaying the data you just sent.

Not useful on its own but if you need to get QR data into your app, here's a way to do it.

7 Likes