Skip to content

Commit

Permalink
Option to manually set room order
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Litzenburger committed Mar 1, 2022
1 parent 507c527 commit 2e2d964
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions MMM-BoschSmartHome.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Click here for the Magic Mirror [Forum Thread](https://forum.magicmirror.builder
Contribution welcome.

### Support
If you like this module and want to thank, please rate this repository with a star or buy me a coffee :-)

<a href="https://www.buymeacoffee.com/jalibu" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Beer" style="height: 45px !important;width: 180px !important;" ></a>
If you like this module and want to thank, please rate this repository with a star or [buy me a coffee](https://paypal.me/jalibu).

## Features

Expand Down Expand Up @@ -63,6 +61,7 @@ If you like this module and want to thank, please rate this repository with a st
width: "340px",
displayRoomIcons: false, // Default: false
hideComponents: {}, // See example below. Default: {}
roomOrder: [], // Manually set the room order by a list of room names, e.g. ["Livingroom", "Bedroom", "Kitchen"]
airquality: {
purity: "bar", // one of [tile, bar, donut, none]
humidity: "bar", // one of [tile, bar, donut, none]
Expand All @@ -86,7 +85,7 @@ If you like this module and want to thank, please rate this repository with a st
You can hide individual components per room. Check sample for possible values:

```javascript
config: {
config: {
hideComponents: {
"Livingroom": ["temperature", "purity", "humidity"],
"Bed Room": ["battery", "climateControl", "temperatureLevel", "hue"],
Expand Down
4 changes: 2 additions & 2 deletions node_helper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmm-bosch-smart-home",
"version": "1.2.1",
"version": "1.3.0",
"description": "A client interface for the Bosch Smart Home System on the MagicMirror² platform.",
"main": "MMM-BoschSmartHome.js",
"repository": {
Expand Down
7 changes: 6 additions & 1 deletion src/backend/BshClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export default class BshbClient {

if (!this.rooms) {
const { parsedResponse: rooms } = await this.client.getRooms().toPromise()
this.rooms = rooms

// Change room order if configured
this.rooms = rooms.sort((a: Room, b: Room) => {
return this.config.roomOrder.indexOf(a.name) - this.config.roomOrder.indexOf(b.name)
})

Log.info('Retrieved rooms from BSHB.')
}

Expand Down
6 changes: 1 addition & 5 deletions src/frontend/Frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Module.register<Config>('MMM-BoschSmartHome', {
defaults: {
mocked: false,
debug: false,
header: null,
host: '192.168.0.150',
name: 'MMM-BoschSmartHome',
identifier: 'MMM-BoschSmartHome',
password: '',
width: '340px',
refreshIntervalInSeconds: 60,
displayRoomIcons: false,
roomOrder: [],
hideComponents: {}, // see README.md
airquality: {
purity: 'bar', // one of [tile, bar, donut, none]
Expand Down Expand Up @@ -57,10 +57,6 @@ Module.register<Config>('MMM-BoschSmartHome', {
}
},

getHeader() {
return this.config.header
},

start() {
this.rooms = []
this.error = null
Expand Down
2 changes: 1 addition & 1 deletion src/types/Config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export type Config = {
mocked: boolean
debug: boolean
header: string
host: string
name: string
identifier: string
password: string
width: string
hideComponents: any
roomOrder: string[]
refreshIntervalInSeconds: number
displayRoomIcons: boolean
temperatureLevel: TemperatureLevelConfig
Expand Down

0 comments on commit 2e2d964

Please sign in to comment.