MagicMirror Smartthings module

I just released a new module to display device statues on MagicMirror if anyone is interested.

My MagicMirror project is not using a mirror, just a standard display: https://forum.magicmirror.builders/topic/11153/new-non-mirror

5 Likes

I like that.
I might push myself to finish mine off now.
I did the basic setup but never got round to getting a display.

I followed your instructions and i see the header ā€˜SMARTTHINGSā€™ but i get only ā€˜Loadingā€™ below it. Any ideas why this could be happening?

What options are you using in the config? If you start MM using dev mode or open the dev console are there any errors?

Thanks for the reply.
For the config, i used your configuration, i replaced contactSensor and lock capabilities with temperatureMeasurement and motionSensor since i donā€™t have any locks. I obviously created a personal access token and added that to the config.
I wasnā€™t sure if the id had to be like this ā€˜ā€™ or like this ā€˜abcdefgā€™ so i tried both. I restarted the raspberry pie just to be sure.

How can i I can check the dev console to see for any errors? I can do that once i get home.

Start MM in dev mode using:
npm start dev

Iā€™ll test using those configs and see if I get any issues as well.

sounds good, iā€™m online now so i can work on it. I will report back in a few

I just did a test using those and all of mine displayed fine in the module. Wondering if you have some special characters in your device names or anything like that?

If you have MM running via PM2, you can type the following to display the last few lines of the logs, but scrolling up youā€™ll see the paths to the logs to view their full content:

pm2 logs MagicMirror

or if your name for the service is different:

pm2 log serviceNameHere

you can see the list of service names using:

pm2 list

ok i will try this first

0 info it worked if it ends with ok
1 verbose cli [ ā€˜/usr/bin/nodeā€™, ā€˜/usr/bin/npmā€™, ā€˜startā€™ ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose run-script [ ā€˜prestartā€™, ā€˜startā€™, ā€˜poststartā€™ ]
5 info lifecycle magicmirror@2.8.0~prestart: magicmirror@2.8.0
6 info lifecycle magicmirror@2.8.0~start: magicmirror@2.8.0
7 verbose lifecycle magicmirror@2.8.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle magicmirror@2.8.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle magicmirror@2.8.0~start: CWD: /home/pi/MagicMirror
10 silly lifecycle magicmirror@2.8.0~start: Args: [ ā€˜-cā€™, ā€˜sh run-start.shā€™ ]
11 silly lifecycle magicmirror@2.8.0~start: Returned: code: 1 signal: null
12 info lifecycle magicmirror@2.8.0~start: Failed to exec start script
13 verbose stack Error: magicmirror@2.8.0 start: sh run-start.sh
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid magicmirror@2.8.0
15 verbose cwd /home/pi/MagicMirror
16 verbose Linux 4.19.57-v7l+
17 verbose argv ā€œ/usr/bin/nodeā€ ā€œ/usr/bin/npmā€ ā€œstartā€
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error magicmirror@2.8.0 start: sh run-start.sh
22 error Exit status 1
23 error Failed at the magicmirror@2.8.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

i see this when i start the magicmirror btwā€¦ i removed my samsung id
url: https://api.smartthings.com/v1/devices
method: GET
json: true
headers:
Authorization: Bearer mysamsungidabcde
qs:
capability: temperatureMeasurement
body:

Ok, Are running the start from an ssh window or on the pi itself. If itā€™s via ssh, that error would be because it canā€™t find electron in ssh, youā€™d need to run the npm start dev on the piā€™s terminal.

You can change the ipwhitelist and address to allow connections from a regular web browser on another pc.

It looks like itā€™s getting the device info from your last post.

Are there any other messages like that or just that one?

messages like the one from the magicmirror when it starts? Yes, one for motionSensor and one for temperatureMeasurement. It seems that it is repeating a few times.

Iā€™m working through VNC right now because i just broke the mini hdmi adaptor. Iā€™m getting a new one in about an hour and i can run npm start dev once i hook up the monitor again.
What should i report back once i start in dev mode?

There should be one for each device after each of those, so seems to be getting hung up looping those. All of my devices were under a Component called ā€œmainā€, which I assumed was standard, but maybe itā€™s not. Let me do some checking on that.
If youā€™re willing to do some testing, you can send a request for the device information using a rest client in chrome. The request information is in the screenshot, just pass your key using the Authorization header in a GET request. It isnā€™t obvious in that , but you can scroll down in the frame wehre the green bar is to see the json results. Under one of the deviceā€™s, look for Components and see if itā€™s called ā€œmainā€.

I use an extension in chrome that lets me test rest connections call Rest Client: https://chrome.google.com/webstore/detail/restlet-client-rest-api-t/aejoelaoggembcahagimdiliamlcdmfm

Also have you tried just one capability at a time to narrow down if itā€™s related to connection or capability?

unless i did something wrong, i got a [401 Unauthorized]
yes i tried with one capability

Ah, so 401. Maybe generate a new samsung key and try it?

Just tried itā€¦ same thing 401.
Does it matter that i am in EU?