Closed piznel closed 5 years ago
You mean just change Wemore's internal state so a "toggle" command sent to it works as expected? There's a property .binaryState
on the device instance; just set it to 1
(on) or 0
(off).
thank you for your very quick answer:)
So that means that, using the example of emulated TV in your readme:
tv.binaryState = 1
will update the TV status in Alexa?
I also have a small problem with the example you give next:
tv.on('state', function(binaryState, self, sender) {
console.log("TV set to=", binaryState);
tv.close(); // stop advertising the device
});
What's the point? I read all your code, but I couldn't find the broadcast of the state event.
Thank you in advance!
That won't actively update Alexa's status (it doesn't make any network calls) but if Alexa queries the device, it should see it as "on."
The state
event is broadcast immediately after on
/off
. There's no real difference from the normal events, but it is called for both on
and off
, and you get the raw binary state. In most cases you're probably fine with on
and/or off
, but state
is there for advanced use cases.
Thanks !
Hello, Is it possible to add a function to update the status of a virtual device? Because I use your library by coupling it with a home automation application, and that would allow me to be synchronized between Alexa and the application. Thank you!