Add specific device control
This commit is contained in:
parent
4a2c6aa761
commit
6244f5bd6d
@ -158,9 +158,19 @@ async function processor(group, consumer, streamKey) {
|
||||
break;
|
||||
|
||||
case "light_on":
|
||||
await playAudio("Turning on light.");
|
||||
if (msg.message.argument) {
|
||||
await playAudio("Turning on " + msg.message.argument + " light.")
|
||||
await ha.client.post("/api/services/homeassistant/turn_on", {
|
||||
entity_id: "light." + msg.message.argument + "_" + msg.message.argument
|
||||
}).catch(async (err) => {
|
||||
await playAudio("I have failed you father.");
|
||||
console.error(err);
|
||||
});
|
||||
break;
|
||||
}
|
||||
await playAudio("Turning on lights.");
|
||||
await ha.client.post("/api/services/homeassistant/turn_on", {
|
||||
entity_id: "light.living_room_living_room"
|
||||
entity_id: "light.home_home"
|
||||
}).catch(async (err) => {
|
||||
await playAudio("I have failed you father.");
|
||||
console.error(err);
|
||||
@ -168,9 +178,19 @@ async function processor(group, consumer, streamKey) {
|
||||
break;
|
||||
|
||||
case "light_off":
|
||||
await playAudio("Turning off light.");
|
||||
if (msg.message.argument) {
|
||||
await playAudio("Turning off " + msg.message.argument + " light.")
|
||||
await ha.client.post("/api/services/homeassistant/turn_off", {
|
||||
entity_id: "light." + msg.message.argument + "_" + msg.message.argument
|
||||
}).catch(async (err) => {
|
||||
await playAudio("I have failed you father.");
|
||||
console.error(err);
|
||||
});
|
||||
break;
|
||||
}
|
||||
await playAudio("Turning off lights.");
|
||||
await ha.client.post("/api/services/homeassistant/turn_off", {
|
||||
entity_id: "light.living_room_living_room"
|
||||
entity_id: "light.home_home"
|
||||
}).catch(async (err) => {
|
||||
await playAudio("I have failed you father.");
|
||||
console.error(err);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user