Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Apr 5, 2020
0 parents commit f68c146
Show file tree
Hide file tree
Showing 29 changed files with 2,025 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is a basic workflow to help you get started with Actions
name: Publish to NPM

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
- dev

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
node-version: 12.15
registry-url: https://registry.npmjs.org/

- name: Install npm dependencies
run: npm i

- name: Publish release
run: npm publish --access public
if: github.ref == 'refs/heads/master'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Update the package version
if: github.ref == 'refs/heads/dev'
run: node scripts/update-package-version.js $GITHUB_RUN_ID

- name: Publish beta release
run: npm publish --tag next --access public
if: github.ref == 'refs/heads/dev'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist
debug

.DS_Store
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
src
scripts

.DS_Store
.gitignore
tsconfig.json
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changelog

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Elio Struyf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Presence switch connected to Microsoft Graph

*To be added*

## Local development

```
nvm use v12
cd ~/.nvm/versions/node/v12.15.0/bin/
homebridge -D -I -U ~/nodejs/homebridge/homebridge-presence-switch-msgraph/debug -P ~/nodejs/homebridge/homebridge-presence-switch-msgraph
```

## Config

- AppId
- API URL to call
- Light states
- Available
- Away
- Bussy
- Light settings
- type: none, blink, ...
- brightness: 0.4 - 1
125 changes: 125 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"pluginAlias": "presence-switch",
"pluginType": "accessory",
"singular": false,
"headerDisplay": "Microsoft Graph Presence Switch",
"footerDisplay": "Plugin which allows you retrieve your presence via the Microsoft Graph and call your busy light API.",
"schema": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string",
"default": "Presence Indicator",
"required": true
},
"appId": {
"title": "Azure AD application ID",
"description": "The GUID of the Azure AD app.",
"type": "string",
"required": true
},
"interval": {
"title": "Interval",
"description": "Polling interval.",
"type": "integer",
"default": 1
},
"setColorApi": {
"title": "Set color API",
"description": "API to set the color",
"type": "string",
"required": true
},
"offApi": {
"title": "Off API",
"description": "API to turn off your device",
"type": "string",
"required": true
},
"onApi": {
"title": "On API",
"description": "API to turn on your device",
"type": "string",
"required": true
},
"startTime": {
"title": "Start time",
"description": "Define the time when you start your working day (ex: 8:30).",
"type": "string",
"default": ""
},
"endTime": {
"title": "End time",
"description": "Define the time when you end your working day (ex: 18:00).",
"type": "string",
"default": ""
},
"weekend": {
"title": "Weekend checks",
"description": "Do you want to check in the weekends",
"type": "boolean",
"default": false
},
"statusColors": {
"title": "Status color",
"description": "Define the color values for the following states: 'available', 'busy', and 'away'.",
"type": "object",
"properties": {
"available": {
"type": "object",
"properties": {
"red": "string",
"green": "string",
"blue": "string"
}
},
"busy": {
"type": "object",
"properties": {
"red": "string",
"green": "string",
"blue": "string"
}
},
"away": {
"type": "object" ,
"properties": {
"red": "string",
"green": "string",
"blue": "string"
}
}
}
},
"lightType": {
"title": "Light type",
"description": "Define the type of light you want to show.",
"type": "string",
"default": "switch",
"oneOf": [
{
"title": "Always on",
"enum": [ "on" ]
},
{
"title": "Blink",
"enum": [ "blink" ]
},
{
"title": "Hearthbeat",
"enum": [ "hearthbeat" ]
}
]
},
"debug": {
"title": "Debug",
"type": "boolean",
"default": false,
"required": false
}
}
},
"form": null,
"display": null
}
Loading

0 comments on commit f68c146

Please sign in to comment.