Closed johngo7470 closed 5 years ago
state_*
is optional. As you've noted, the devices are able to be turned on and off without them.
The only plugin currently included with Fauxmo is SimpleHTTPPlugin, which has sufficient documentation, and the information is additionally noted prominently in the README.
In the README, it states: "As of Fauxmo v0.4.5, SimpleHTTPPlugin also supports (and Fauxmo requires) a get_state method".
So now I'm even more confused... is it optional or is it required?
Sorry that this seems confusing. I think it's written correctly. My impression is that you're new to Python, and it's great to see your interest in getting this working. Please pass on any recommendations that might make my documentation more friendly to new users, or feel free to make a pull request.
To the end of getting things working, please look through the source code and documentation of SimpleHTTPPlugin (and thanks for pointing out that the hosted docs were failing to update). Fauxmo and SimpleHTTPPlugin are separate concepts; plugins simply have to fulfill an interface and Fauxmo will call the necessary methods in order to turn devices on, off, or query their state.
Through the FauxmoPlugin abstract base class, from which all plugins must inherit, Fauxmo requires plugins to implement a get_state
method.
A user can optionally configure SimpleHTTPPlugin's state_*
optional kwargs. (In Python an optional keyword argument is one that includes a default value.)
Whether or not the user configures these, SimpleHTTPPlugin continues to use its get_state
method (or rather Fauxmo continues to use it). By default, this specific plugin's get_state
method's behavior is to return unknown,
as we've discussed.
Based on my testing (please see my last entry in Issue 80), simplehttpplugin requires the inclusion of state_cmd, state_response_on, and state_response_off, and that the cgi pointed to by state_cmd, returns the text defined by state_response_on/state_response_off, to produce the proper audible response from Alexa (usually "ok"), when using Fauxmo 0.4.5 or later.
Reminder to update config-sample.json, to include get_state URL definition for all defined devices.