Disable Onkyo controls when the onkyo2mqtt bridge is not connected

This commit is contained in:
Ranlvor 2017-11-04 15:32:05 +01:00
parent f4b611149b
commit 8f91bf6046
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E

View file

@ -58,6 +58,12 @@ const config : Config = {
blue: "blue", green: "green", red: "red", random: "random", blue: "blue", green: "green", red: "red", random: "random",
cycle: "cycle-random" } cycle: "cycle-random" }
}, },
onkyo_connection: {
state: "/service/onkyo/connected",
command: "",
defaultValue: 0,
values: { disconnected: 0, connecting: 1, connected: 2 },
},
onkyo_power: { onkyo_power: {
state: "/service/onkyo/status/system-power", state: "/service/onkyo/status/system-power",
command: "/service/onkyo/command", command: "/service/onkyo/command",
@ -264,14 +270,16 @@ const config : Config = {
onkyo: { onkyo: {
name: "Onkyo", name: "Onkyo",
position: [350, 650], position: [350, 650],
iconColor: state => state.onkyo_power == "on" ? "#00FF00" : "#000000", iconColor: state =>
state.onkyo_connection != "connected" ? "#888888" : (state.onkyo_power == "on" ? "#00FF00" : "#000000"),
icon: "volume_up", icon: "volume_up",
ui: [ ui: [
{ {
type: "toggle", type: "toggle",
text: "Power", text: "Power",
icon: "power_settings_new", icon: "power_settings_new",
topic: "onkyo_power" topic: "onkyo_power",
enableCondition: (a, b, state) => state.onkyo_connection == "connected"
}, },
{ {
type: "section", type: "section",
@ -283,13 +291,15 @@ const config : Config = {
topic: "onkyo_volume", topic: "onkyo_volume",
min: 0, min: 0,
max: 50, max: 50,
icon: "volume_up" icon: "volume_up",
enableCondition: (a, b, state) => state.onkyo_connection == "connected"
}, },
{ {
type: "toggle", type: "toggle",
text: "Mute", text: "Mute",
topic: "onkyo_mute", topic: "onkyo_mute",
icon: "volume_off" icon: "volume_off",
enableCondition: (a, b, state) => state.onkyo_connection == "connected"
}, },
{ {
type: "section", type: "section",
@ -305,7 +315,8 @@ const config : Config = {
chromecast: "Chromecast", chromecast: "Chromecast",
pult: "Pult" pult: "Pult"
}, },
icon: "settings_input_component" icon: "settings_input_component",
enableCondition: (a, b, state) => state.onkyo_connection == "connected"
}, },
{ {
type: "dropDown", type: "dropDown",
@ -322,7 +333,7 @@ const config : Config = {
somafm_lush: "Lush (SomaFM)" somafm_lush: "Lush (SomaFM)"
}, },
icon: "radio", icon: "radio",
enableCondition: (a, b, state) => state.onkyo_inputs == "netzwerk" enableCondition: (a, b, state) => state.onkyo_connection == "connected" && state.onkyo_inputs == "netzwerk"
}, },
{ {
type: "section", type: "section",