HA switch takes a type argument

This lets you pass the domain to the switch to let it be other types of
objects, like say, a scene.
This commit is contained in:
Jon Maddox
2015-09-16 03:14:09 -04:00
parent f3e08b0a15
commit 7f753f79f6

View File

@@ -399,9 +399,9 @@ HomeAssistantMediaPlayer.prototype = {
} }
function HomeAssistantSwitch(log, data, client) { function HomeAssistantSwitch(log, data, client, type) {
// device info // device info
this.domain = "switch" this.domain = type || "switch"
this.data = data this.data = data
this.entity_id = data.entity_id this.entity_id = data.entity_id
if (data.attributes && data.attributes.friendly_name) { if (data.attributes && data.attributes.friendly_name) {