Coder Social home page Coder Social logo

buzzkc / mmm-smartthings Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 2.0 73 KB

MagicMirror module to connect smartthings api and displays device statuses.

License: MIT License

JavaScript 92.89% CSS 7.11%
home-automation smarthome smartthings-api magicmirror

mmm-smartthings's Introduction

MMM-Smartthings

This is a module for the MagicMirror².

MagicMirror module that connects to the Samsung Smartthings api to display device status information.

Example

Dependencies

Installation

Setup the MagicMirror module

cd ~/MagicMirror/modules
git clone https://github.com/buzzkc/MMM-Smartthings.git
cd MMM-Smartthings
npm install

Using the module

To use this module, add the following configuration block to the modules array in the config/config.js file:

var config = {
    modules: [
        {
              module: "MMM-Smartthings",
              position: "top_left",
              header: "Smartthings",
              config: {
                personalAccessToken: 'your_smarthings_api_key',
                capabilities: [
                    'contactSensor',
                    'lock'
                ],
                title: "Doors & Locks",
                excludedDeviceNames: [
                    'Sense-', // Contains this text
                    'Virtual Lock Test' // Or is a specific device label
                ]
              }
        }
    ]
}

Configuration options

Option Description
personalAccessToken Required Setup your personal access token at https://account.smartthings.com/tokens
capabilities Required An array of device capabilities to display statuses for. Supported capabilities: "switch", "contactSensor", "lock", "temperatureMeasurement", "relativeHumidityMeasurement", & "motionSensor"
updateInterval Optional The number of milliseconds between updates
Type: int(milliseconds)
Default 30000 milliseconds (30 seconds)
title Optional The sub-heading title for device list
excludedDeviceNames Optional An array of device names or strings contained in the device label, can be excluded by containing a given word or the full name. Be more specific if devices you want to see are getting excluded.
tempLowValue Optional The low threshold for temperature monitoring Default: 65 Type: int
tempHighValue Optional The high threshold for temperature monitoring Default: 80 Type: int
title Optional The sub-heading title for device list

Future Enhancements

Thanks To

mmm-smartthings's People

Contributors

buzzkc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mmm-smartthings's Issues

Only Display ON devices

Hello, I have very little coding experience, but I’ve wondering if there is a way to filter the list of displayed devices by status and then only display the ones that are ON. For now, I’ve temporarily done this by making the .sensor.error opacity 0.

Add ability to send notification of contact sensor opening (Mail Delivery)

I have a contact sensor within my mailbox. When the door to the mailbox is opened then the open/close sensor sends notification to my Smarthings Hub. In the past I had that setup as a voice notification over my home audio Sonos system. It would announce "The mail has arrived" .
I would like the ability to have an icon on the screen of my MagicMirror that shows an envelope when this contact sensor opens on a daily basis. When the mail box is opened the second time (that would be mail retrieval by a human) then notification is sent to the MagicMirror to cancel (remove) the Envelope Icon.

Whenever magic mirror boots up everything is doubled

Whenever I boot up magic mirror and all the modules are showing. For the first 20ish seconds all the items that are shown are doubled. For example the same sensors will be shown 2 times and it is the same with all the items for the first 20 seconds until they automatically disappear and then there is only one of each item.

PLease dont let this module die!

Hello,

I just upgraded my NPM, the Node and my MM to the latest versions and when I'm trying to install this module I get a ton of errors and I need to remove the Smartthings folder just to be able to start Magic Mirror again.
Please don't let this module die I´ve been using it for years now, its so handy!

Here's my log I hope it helps:

0 verbose cli /usr/bin/node /usr/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 4ms
4 timing config:load:defaults Completed in 8ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 10ms
8 timing config:load:env Completed in 2ms
9 timing config:load:file:/home/bm/MagicMirror/modules/MMM-Smartthings/.npmrc Completed in 1ms
10 timing config:load:project Completed in 16ms
11 timing config:load:file:/home/bm/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/etc/npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 4ms
16 timing config:load Completed in 49ms
17 timing npm:load:configload Completed in 50ms
18 timing config:load:flatten Completed in 12ms
19 timing npm:load:mkdirpcache Completed in 1ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm install
22 verbose argv "install"
23 timing npm:load:setTitle Completed in 3ms
24 timing npm:load:display Completed in 2ms
25 verbose logfile logs-max:10 dir:/home/bm/.npm/_logs/2023-12-17T12_42_43_828Z-
26 verbose logfile /home/bm/.npm/_logs/2023-12-17T12_42_43_828Z-debug-0.log
27 timing npm:load:logFile Completed in 42ms
28 timing npm:load:timers Completed in 1ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 183ms
31 timing arborist:ctor Completed in 4ms
32 silly logfile start cleaning logs, removing 1 files
33 silly logfile done cleaning log files
34 timing arborist:ctor Completed in 0ms
35 timing idealTree:init Completed in 99ms
36 timing idealTree:userRequests Completed in 1ms
37 silly idealTree buildDeps
38 silly fetch manifest [email protected]
39 http fetch GET 200 https://registry.npmjs.org/smartthings-node 1393ms (cache revalidated)
40 silly fetch manifest grunt@latest
41 http fetch GET 200 https://registry.npmjs.org/grunt 775ms (cache revalidated)
42 silly fetch manifest grunt-eslint@latest
43 http fetch GET 200 https://registry.npmjs.org/grunt-eslint 291ms (cache revalidated)
44 silly fetch manifest grunt-jsonlint@latest
45 http fetch GET 200 https://registry.npmjs.org/grunt-jsonlint 273ms (cache revalidated)
46 silly fetch manifest grunt-markdownlint@^1.0.13
47 http fetch GET 200 https://registry.npmjs.org/grunt-markdownlint 889ms (cache revalidated)
48 silly fetch manifest grunt-stylelint@latest
49 http fetch GET 200 https://registry.npmjs.org/grunt-stylelint 293ms (cache revalidated)
50 silly fetch manifest [email protected]
51 http fetch GET 200 https://registry.npmjs.org/stylelint 115ms (cache revalidated)
52 silly fetch manifest grunt-yamllint@latest
53 http fetch GET 200 https://registry.npmjs.org/grunt-yamllint 769ms (cache revalidated)
54 silly fetch manifest stylelint-config-standard@latest
55 http fetch GET 200 https://registry.npmjs.org/stylelint-config-standard 293ms (cache revalidated)
56 silly fetch manifest stylelint@^16.0.0
57 silly fetch manifest time-grunt@latest
58 http fetch GET 200 https://registry.npmjs.org/time-grunt 270ms (cache revalidated)
59 silly placeDep ROOT [email protected] OK for: [email protected] want: latest
60 silly fetch manifest dateformat@~4.6.2
61 silly fetch manifest eventemitter2@~0.4.13
62 silly fetch manifest exit@~0.1.2
63 silly fetch manifest findup-sync@~5.0.0
64 silly fetch manifest glob@~7.1.6
65 silly fetch manifest grunt-cli@~1.4.3
66 silly fetch manifest grunt-known-options@~2.0.0
67 silly fetch manifest grunt-legacy-log@~3.0.0
68 silly fetch manifest grunt-legacy-util@~2.0.1
69 silly fetch manifest iconv-lite@~0.6.3
70 silly fetch manifest js-yaml@~3.14.0
71 silly fetch manifest minimatch@~3.0.4
72 silly fetch manifest nopt@~3.0.6
73 silly placeDep ROOT [email protected] OK for: [email protected] want: latest
74 silly fetch manifest chalk@^4.1.2
75 silly fetch manifest eslint@^8.44.0
76 silly placeDep ROOT [email protected] OK for: [email protected] want: latest
77 silly fetch manifest @prantlf/[email protected]
78 silly placeDep ROOT [email protected] OK for: [email protected] want: ^1.0.13
79 silly fetch manifest markdownlint@^0.10.0
80 silly placeDep ROOT [email protected] OK for: [email protected] want: latest
81 silly placeDep ROOT [email protected] OK for: [email protected] want: 15.x
82 silly fetch manifest @csstools/css-parser-algorithms@^2.3.1
83 silly fetch manifest @csstools/css-tokenizer@^2.2.0
84 silly fetch manifest @csstools/media-query-list-parser@^2.1.4
85 silly fetch manifest @csstools/selector-specificity@^3.0.0
86 silly fetch manifest balanced-match@^2.0.0
87 silly fetch manifest colord@^2.9.3
88 silly fetch manifest cosmiconfig@^8.2.0
89 silly fetch manifest css-functions-list@^3.2.1
90 silly fetch manifest css-tree@^2.3.1
91 silly fetch manifest debug@^4.3.4
92 silly fetch manifest fast-glob@^3.3.1
93 silly fetch manifest fastest-levenshtein@^1.0.16
94 silly fetch manifest file-entry-cache@^7.0.0
95 silly fetch manifest global-modules@^2.0.0
96 silly fetch manifest globby@^11.1.0
97 silly fetch manifest globjoin@^0.1.4
98 silly fetch manifest html-tags@^3.3.1
99 silly fetch manifest ignore@^5.2.4
100 silly fetch manifest import-lazy@^4.0.0
101 silly fetch manifest imurmurhash@^0.1.4
102 silly fetch manifest is-plain-object@^5.0.0
103 silly fetch manifest known-css-properties@^0.29.0
104 silly fetch manifest mathml-tag-names@^2.1.3
105 silly fetch manifest meow@^10.1.5
106 silly fetch manifest micromatch@^4.0.5
107 silly fetch manifest normalize-path@^3.0.0
108 silly fetch manifest picocolors@^1.0.0
109 silly fetch manifest postcss@^8.4.28
110 silly fetch manifest postcss-resolve-nested-selector@^0.1.1
111 silly fetch manifest postcss-safe-parser@^6.0.0
112 silly fetch manifest postcss-selector-parser@^6.0.13
113 silly fetch manifest postcss-value-parser@^4.2.0
114 silly fetch manifest resolve-from@^5.0.0
115 silly fetch manifest string-width@^4.2.3
116 silly fetch manifest strip-ansi@^6.0.1
117 silly fetch manifest style-search@^0.1.0
118 silly fetch manifest supports-hyperlinks@^3.0.0
119 silly fetch manifest svg-tags@^1.0.0
120 silly fetch manifest table@^6.8.1
121 silly fetch manifest write-file-atomic@^5.0.1
122 silly placeDep ROOT [email protected] OK for: [email protected] want: latest
123 silly fetch manifest async@^2.1.5
124 silly fetch manifest js-yaml@^3.8.1
125 silly fetch manifest chalk@^1.1.3
126 silly placeDep ROOT [email protected] OK for: [email protected] want: 0.0.4
127 silly fetch manifest @types/[email protected]
128 silly fetch manifest @types/[email protected]
129 silly fetch manifest @types/request@^2.0.9
130 silly fetch manifest @types/request-promise@^4.1.39
131 silly fetch manifest config@^1.29.0
132 silly fetch manifest prettyjson@^1.2.1
133 silly fetch manifest request@^2.83.0
134 silly fetch manifest request-promise@^4.2.2
135 timing idealTree Completed in 6055ms
136 timing command:install Completed in 6113ms
137 verbose stack Error: could not resolve
137 verbose stack at PlaceDep.failPeerConflict (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:503:25)
137 verbose stack at new PlaceDep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:157:21)
137 verbose stack at #buildDepStep (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:933:18)
137 verbose stack at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:196:7)
137 verbose stack at async Promise.all (index 1)
137 verbose stack at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:159:5)
137 verbose stack at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:152:5)
137 verbose stack at async module.exports (/usr/lib/node_modules/npm/lib/cli-entry.js:61:5)
138 verbose cwd /home/bm/MagicMirror/modules/MMM-Smartthings
139 verbose Linux 6.1.66-v7+
140 verbose node v21.4.0
141 verbose npm v10.2.4
142 error code ERESOLVE
143 error ERESOLVE could not resolve
144 error
145 error While resolving: �[1mMMM-Smartthings�[22m@�[1m1.0.0�[22m
145 error Found: �[1mstylelint�[22m@�[1m15.11.0�[22m�[2m�[22m
145 error �[2mnode_modules/stylelint�[22m
145 error �[35mpeer�[39m �[1mstylelint�[22m@"�[1m15.x�[22m" from �[1mgrunt-stylelint�[22m@�[1m0.19.0�[22m�[2m�[22m
145 error �[2mnode_modules/grunt-stylelint�[22m
145 error �[33mdev�[39m �[1mgrunt-stylelint�[22m@"�[1mlatest�[22m" from the root project
145 error
145 error Could not resolve dependency:
145 error �[33mdev�[39m �[1mstylelint-config-standard�[22m@"�[1mlatest�[22m" from the root project
145 error
145 error Conflicting peer dependency: �[1mstylelint�[22m@�[1m16.0.2�[22m�[2m�[22m
145 error �[2mnode_modules/stylelint�[22m
145 error �[35mpeer�[39m �[1mstylelint�[22m@"�[1m^16.0.0�[22m" from �[1mstylelint-config-standard�[22m@�[1m35.0.0�[22m�[2m�[22m
145 error �[2mnode_modules/stylelint-config-standard�[22m
145 error �[33mdev�[39m �[1mstylelint-config-standard�[22m@"�[1mlatest�[22m" from the root project
145 error
145 error Fix the upstream dependency conflict, or retry
145 error this command with --force or --legacy-peer-deps
145 error to accept an incorrect (and potentially broken) dependency resolution.
146 error
146 error
146 error For a full report see:
146 error /home/bm/.npm/_logs/2023-12-17T12_42_43_828Z-eresolve-report.txt
147 verbose exit 1
148 timing npm Completed in 7741ms
149 verbose unfinished npm timer reify 1702816965439
150 verbose unfinished npm timer reify:loadTrees 1702816965476
151 verbose unfinished npm timer idealTree:buildDeps 1702816965583
152 verbose unfinished npm timer idealTree:#root 1702816965586
153 verbose code 1

Headers for each capability

@unreal2k@smartthings community:
Could there could be multiple headers. For example:
Sensors
Sensor1
Sensor2

Themperatures
Temp1
Temp2

Locks
Lock1
Lock2

In the config: {} there could be:
showHeader: true,
headerText: ‘Locks’

What do you think?

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.