API wrapper (through official API, with more features and tools) for Myfox domotics
An API layer to Myfox services to add easy usable features & tools, written in NodeJS.
The current release is a working version of a minimalist lib. Rest API strategy is not ready for use. Works only with HTML API strategy
This API layer will serve you full control over a Myfox service (alarm and domotics), calling basic features through official html website (parsing data retrieved by a curl robot), and will add many features (mainly precoded macro features).
Because the Myfox Rest API is the official one. If you want to use it, then, use it directly. But it does not allow everything (like editing a scenario for example!)... And I cannot extend the official API due to license limitations from Myfox side.
Through the official HTML website, we can do really much more than from the existing Rest API (editing scenarii, see much more information). But this layer can be easily broken if the website evolves. This is the counter side of the idea.
Well, for now, you cannot with this project. Maybe later, I will plan to have dual channel calls (a part through HTML website and another part through Rest API), but I need the rights from Myfox to do it, to finally have:
(Please see the Quick Start guide below, or the Wiki Documentation to understand the strategy of the system)
To let you control Myfox services in time (e.g.: schedule a scenario call 60 minutes after another scenario call, with programmable conditions to cancel a scheduled task; planify changes in a scenario configuration depending on day time, like maximum and minimum temperatures in a complex scenario; ...)
(For a full install guide, please go to the Wiki home page)
npm install --save myfox-wrapper-api
To contribute to the myfox-wrapper-api project as a developer, you should clone the repository, and follow the CONTRIBUTING.md document.
At boot time, the server will ask you username and password that you want to use to connect to Myfox services. This credentials are kept in memory only (not stored anywhere) and lost at server stop. That means one server instance can serve only 1 Myfox account at runtime!
This instance will deliver a swagger.json file (auto-generated) to expose the API, that you can use with an external Swagger server, or via the built-in Swagger server:
TODO: The default built-in server is made over hapi. There is an express server for example/test purpose only (do not use directly because the I/O data format is not checked and then not protected against attacks).
For now, build-in server can be used in real use case, but be aware that the server is not protected at all: no authentication is needed to connect to the API. Even if the Myfox password is required at startup, once the right password is given and pushed into the stateful instance of the wrapper, then any request that follows the first one will be possible without any authentication. As the server uses a stateful wrapper instance, a server can handle only 1 myfox account at a time. This wrapper is best fitted in a private trusted network, like in a private house network, without any door/mapping opened to the www.
TODO direct use as library (not the included server, so how to dev)