RZL: Move onkyo config into seperate file
This commit is contained in:
parent
8738577001
commit
837f5a2bc4
5 changed files with 226 additions and 197 deletions
3
.babelrc
3
.babelrc
|
|
@ -3,6 +3,7 @@
|
|||
["env", { modules: false }], "react"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-class-properties"
|
||||
"transform-class-properties",
|
||||
"transform-object-rest-spread"
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import { hex, rgb, rgba, rainbow } from "config/colors";
|
|||
import { mdi, rawMdi, mdiBattery } from "config/icon";
|
||||
import { esper_topics, esper_statistics, floalt, tradfri_remote } from "../utils";
|
||||
|
||||
const config : Config = {
|
||||
import * as onkyo from "./onkyo";
|
||||
|
||||
const config: Config = {
|
||||
space: {
|
||||
name: "RZL",
|
||||
color: "orange",
|
||||
|
|
@ -101,116 +103,6 @@ const config : Config = {
|
|||
},
|
||||
defaultValue: "off"
|
||||
},
|
||||
onkyo_connection: {
|
||||
state: {
|
||||
name: "/service/onkyo/connected",
|
||||
type: types.option({
|
||||
"0": "disconnected",
|
||||
"1": "connecting",
|
||||
"2": "connected"
|
||||
})
|
||||
},
|
||||
defaultValue: "disconnected"
|
||||
},
|
||||
onkyo_power: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/system-power",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
PWR00: "off",
|
||||
PWR01: "on"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({ off: "PWR00", on: "PWR01" })
|
||||
},
|
||||
defaultValue: "off"
|
||||
},
|
||||
onkyo_mute: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/audio-muting",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
AMT00: "off",
|
||||
AMT01: "on"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({ off: "AMT00", on: "AMT01" })
|
||||
},
|
||||
defaultValue: "off"
|
||||
},
|
||||
onkyo_volume: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/volume",
|
||||
type: types.json("val")
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/set/volume",
|
||||
type: types.string
|
||||
},
|
||||
defaultValue: "0"
|
||||
},
|
||||
onkyo_inputs: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/input-selector",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
SLI11: "tisch",
|
||||
SLI01: "chromecast",
|
||||
SLI10: "pult",
|
||||
SLI2B: "netzwerk",
|
||||
SLI03: "front",
|
||||
otherwise: "unknown"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({
|
||||
tisch: "SLI11",
|
||||
chromecast: "SLI01",
|
||||
pult: "SLI10",
|
||||
netzwerk: "SLI2B",
|
||||
front: "SLI03",
|
||||
unknown: "SLI00"
|
||||
})
|
||||
},
|
||||
defaultValue: "unknown",
|
||||
},
|
||||
onkyo_radios: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/latest-NPR",
|
||||
type: types.option({
|
||||
NPR01: "mpd",
|
||||
NPR02: "kohina",
|
||||
NPR03: "somafm_dronezone",
|
||||
NPR04: "somafm_thetrip",
|
||||
NPR05: "querfunk",
|
||||
NPR06: "somafm_defconradio",
|
||||
NPR07: "somafm_secretagent",
|
||||
NPR08: "somafm_lush",
|
||||
NPR09: "somafm_beatblender",
|
||||
NPR0a: "ponyville",
|
||||
otherwise: "unknown"
|
||||
})
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({
|
||||
mpd: "NPR01",
|
||||
kohina: "NPR02",
|
||||
somafm_dronezone: "NPR03",
|
||||
somafm_thetrip: "NPR04",
|
||||
querfunk: "NPR05",
|
||||
somafm_defconradio: "NPR06",
|
||||
somafm_secretagent: "NPR07",
|
||||
somafm_lush: "NPR08",
|
||||
somafm_beatblender: "NPR09",
|
||||
ponyville: "NPR0a",
|
||||
otherwise: "NPR00"
|
||||
})
|
||||
},
|
||||
defaultValue: "unknown"
|
||||
},
|
||||
rundumleuchte: {
|
||||
state: {
|
||||
name: "/service/openhab/out/pca301_rundumleuchte/state",
|
||||
|
|
@ -366,9 +258,12 @@ const config : Config = {
|
|||
tradfri_remote.topics("65546"),
|
||||
|
||||
esper_topics("afba40", "flyfry"),
|
||||
esper_topics("afba45", "alarm")
|
||||
esper_topics("afba45", "alarm"),
|
||||
|
||||
onkyo.topics
|
||||
],
|
||||
controls: {
|
||||
...onkyo.controls,
|
||||
led_stahltrager: {
|
||||
name: "LED Stahlträger",
|
||||
position: [380, 590],
|
||||
|
|
@ -523,89 +418,6 @@ const config : Config = {
|
|||
}
|
||||
]
|
||||
},
|
||||
onkyo: {
|
||||
name: "Onkyo",
|
||||
position: [350, 650],
|
||||
iconColor: ({onkyo_connection, onkyo_power}) =>
|
||||
onkyo_connection != "connected" ? hex("#888888") : (onkyo_power == "on" ? hex("#00FF00") : hex("#000000")),
|
||||
icon: mdi("audio-video"),
|
||||
ui: [
|
||||
{
|
||||
type: "toggle",
|
||||
text: "Power",
|
||||
icon: mdi("power"),
|
||||
topic: "onkyo_power",
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "Lautstärkeregelung"
|
||||
},
|
||||
{
|
||||
type: "slider",
|
||||
text: "Volume",
|
||||
topic: "onkyo_volume",
|
||||
min: 0,
|
||||
max: 50,
|
||||
icon: mdi("volume-high"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "toggle",
|
||||
text: "Mute",
|
||||
topic: "onkyo_mute",
|
||||
icon: mdi("volume-off"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "Eingänge"
|
||||
},
|
||||
{
|
||||
type: "dropDown",
|
||||
text: "Eingang",
|
||||
topic: "onkyo_inputs",
|
||||
options: {
|
||||
netzwerk: "Netzwerk",
|
||||
tisch: "Tisch",
|
||||
chromecast: "Chromecast",
|
||||
pult: "Pult",
|
||||
front: "Front HDMI"
|
||||
},
|
||||
icon: mdi("usb"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "dropDown",
|
||||
text: "Netzwerksender",
|
||||
topic: "onkyo_radios",
|
||||
options: {
|
||||
mpd: "MPD",
|
||||
kohina: "Kohina",
|
||||
somafm_dronezone: "Drone Zone (SomaFM)",
|
||||
somafm_thetrip: "The Trip (SomaFM)",
|
||||
querfunk: "Querfunk",
|
||||
somafm_defconradio: "Defcon Radio (SomaFM)",
|
||||
somafm_secretagent: "Secret Agent (SomaFM)",
|
||||
somafm_lush: "Lush (SomaFM)",
|
||||
somafm_beatblender: "Beat Blender (Soma FM)",
|
||||
ponyville: "Ponyville FM"
|
||||
},
|
||||
icon: mdi("radio"),
|
||||
enableCondition: (state) => state.onkyo_connection == "connected" && state.onkyo_inputs == "netzwerk"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "External"
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
link: "http://mpd.rzl/mpd/player/index.php",
|
||||
text: "Open MPD Interface",
|
||||
icon: mdi("open-in-new")
|
||||
}
|
||||
]
|
||||
},
|
||||
rundumleuchte: {
|
||||
name: "Rundumleuchte",
|
||||
position: [310,275],
|
||||
|
|
@ -972,7 +784,7 @@ const config : Config = {
|
|||
topic: tradfri_remote.level("65546")
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
layers: [
|
||||
{
|
||||
|
|
|
|||
204
config/rzl/onkyo.js
Normal file
204
config/rzl/onkyo.js
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
// @flow
|
||||
import type { Topics, Controls } from "config/flowtypes";
|
||||
import { mdi } from "config/icon";
|
||||
import { hex } from "config/colors";
|
||||
import * as types from "config/types";
|
||||
|
||||
export const topics: Topics = {
|
||||
onkyo_connection: {
|
||||
state: {
|
||||
name: "/service/onkyo/connected",
|
||||
type: types.option({
|
||||
"0": "disconnected",
|
||||
"1": "connecting",
|
||||
"2": "connected"
|
||||
})
|
||||
},
|
||||
defaultValue: "disconnected"
|
||||
},
|
||||
onkyo_power: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/system-power",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
PWR00: "off",
|
||||
PWR01: "on"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({ off: "PWR00", on: "PWR01" })
|
||||
},
|
||||
defaultValue: "off"
|
||||
},
|
||||
onkyo_mute: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/audio-muting",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
AMT00: "off",
|
||||
AMT01: "on"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({ off: "AMT00", on: "AMT01" })
|
||||
},
|
||||
defaultValue: "off"
|
||||
},
|
||||
onkyo_volume: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/volume",
|
||||
type: types.json("val")
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/set/volume",
|
||||
type: types.string
|
||||
},
|
||||
defaultValue: "0"
|
||||
},
|
||||
onkyo_inputs: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/input-selector",
|
||||
type: types.json("onkyo_raw", types.option({
|
||||
SLI11: "tisch",
|
||||
SLI01: "chromecast",
|
||||
SLI10: "pult",
|
||||
SLI2B: "netzwerk",
|
||||
SLI03: "front",
|
||||
otherwise: "unknown"
|
||||
}))
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({
|
||||
tisch: "SLI11",
|
||||
chromecast: "SLI01",
|
||||
pult: "SLI10",
|
||||
netzwerk: "SLI2B",
|
||||
front: "SLI03",
|
||||
unknown: "SLI00"
|
||||
})
|
||||
},
|
||||
defaultValue: "unknown",
|
||||
},
|
||||
onkyo_radios: {
|
||||
state: {
|
||||
name: "/service/onkyo/status/latest-NPR",
|
||||
type: types.option({
|
||||
NPR01: "mpd",
|
||||
NPR02: "kohina",
|
||||
NPR03: "somafm_dronezone",
|
||||
NPR04: "somafm_thetrip",
|
||||
NPR05: "querfunk",
|
||||
NPR06: "somafm_defconradio",
|
||||
NPR07: "somafm_secretagent",
|
||||
NPR08: "somafm_lush",
|
||||
NPR09: "somafm_beatblender",
|
||||
NPR0a: "ponyville",
|
||||
otherwise: "unknown"
|
||||
})
|
||||
},
|
||||
command: {
|
||||
name: "/service/onkyo/command",
|
||||
type: types.option({
|
||||
mpd: "NPR01",
|
||||
kohina: "NPR02",
|
||||
somafm_dronezone: "NPR03",
|
||||
somafm_thetrip: "NPR04",
|
||||
querfunk: "NPR05",
|
||||
somafm_defconradio: "NPR06",
|
||||
somafm_secretagent: "NPR07",
|
||||
somafm_lush: "NPR08",
|
||||
somafm_beatblender: "NPR09",
|
||||
ponyville: "NPR0a",
|
||||
otherwise: "NPR00"
|
||||
})
|
||||
},
|
||||
defaultValue: "unknown"
|
||||
}
|
||||
};
|
||||
|
||||
export const controls: Controls = {
|
||||
onkyo: {
|
||||
name: "Onkyo",
|
||||
position: [350, 650],
|
||||
iconColor: ({onkyo_connection, onkyo_power}) =>
|
||||
onkyo_connection != "connected" ? hex("#888888") : (onkyo_power == "on" ? hex("#00FF00") : hex("#000000")),
|
||||
icon: mdi("audio-video"),
|
||||
ui: [
|
||||
{
|
||||
type: "toggle",
|
||||
text: "Power",
|
||||
icon: mdi("power"),
|
||||
topic: "onkyo_power",
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "Lautstärkeregelung"
|
||||
},
|
||||
{
|
||||
type: "slider",
|
||||
text: "Volume",
|
||||
topic: "onkyo_volume",
|
||||
min: 0,
|
||||
max: 50,
|
||||
icon: mdi("volume-high"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "toggle",
|
||||
text: "Mute",
|
||||
topic: "onkyo_mute",
|
||||
icon: mdi("volume-off"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "Eingänge"
|
||||
},
|
||||
{
|
||||
type: "dropDown",
|
||||
text: "Eingang",
|
||||
topic: "onkyo_inputs",
|
||||
options: {
|
||||
netzwerk: "Netzwerk",
|
||||
tisch: "Tisch",
|
||||
chromecast: "Chromecast",
|
||||
pult: "Pult",
|
||||
front: "Front HDMI"
|
||||
},
|
||||
icon: mdi("usb"),
|
||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
||||
},
|
||||
{
|
||||
type: "dropDown",
|
||||
text: "Netzwerksender",
|
||||
topic: "onkyo_radios",
|
||||
options: {
|
||||
mpd: "MPD",
|
||||
kohina: "Kohina",
|
||||
somafm_dronezone: "Drone Zone (SomaFM)",
|
||||
somafm_thetrip: "The Trip (SomaFM)",
|
||||
querfunk: "Querfunk",
|
||||
somafm_defconradio: "Defcon Radio (SomaFM)",
|
||||
somafm_secretagent: "Secret Agent (SomaFM)",
|
||||
somafm_lush: "Lush (SomaFM)",
|
||||
somafm_beatblender: "Beat Blender (Soma FM)",
|
||||
ponyville: "Ponyville FM"
|
||||
},
|
||||
icon: mdi("radio"),
|
||||
enableCondition: (state) => state.onkyo_connection == "connected" && state.onkyo_inputs == "netzwerk"
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: "External"
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
link: "http://mpd.rzl/mpd/player/index.php",
|
||||
text: "Open MPD Interface",
|
||||
icon: mdi("open-in-new")
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
"babel-eslint": "^8.0.1",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"clean-webpack-plugin": "^0.1.18",
|
||||
|
|
|
|||
11
yarn.lock
11
yarn.lock
|
|
@ -719,6 +719,10 @@ babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
|
|||
version "6.18.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
|
||||
|
||||
babel-plugin-syntax-object-rest-spread@^6.8.0:
|
||||
version "6.13.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
|
||||
|
||||
babel-plugin-syntax-trailing-function-commas@^6.22.0:
|
||||
version "6.22.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3"
|
||||
|
|
@ -923,6 +927,13 @@ babel-plugin-transform-flow-strip-types@^6.22.0:
|
|||
babel-plugin-syntax-flow "^6.18.0"
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-transform-object-rest-spread@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
|
||||
dependencies:
|
||||
babel-plugin-syntax-object-rest-spread "^6.8.0"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
babel-plugin-transform-react-display-name@^6.23.0:
|
||||
version "6.25.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.25.0.tgz#67e2bf1f1e9c93ab08db96792e05392bf2cc28d1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue