Sha256: 2755b1bc38ad721391e560aecb1ebb8cf14bbb787d05a84bf9224760bbe972b0
Contents?: true
Size: 1.9 KB
Versions: 6
Compression:
Stored size: 1.9 KB
Contents
# Ewelink Ruby API to manage eWeLink smart home devices. ## Installation Just add this into your `Gemfile`: ```ruby gem 'ewelink' ``` Then, just run `bundle install`. ## Examples ### Displaying all switches ```ruby require 'ewelink' api = Ewelink::Api.new(email: 'john@example.com', password: 'secr$t') api.switches.each do |switch| puts switch[:name] puts switch[:uuid] end ``` `email` or `phone_number` must be specified for authentication. ### Displaying all RF bridge buttons ```ruby require 'ewelink' api = Ewelink::Api.new(email: 'john@example.com', password: 'secr$t') api.rf_bridge_buttons.each do |button| puts button[:name] puts button[:uuid] end ``` ### Turn switch on or off ```ruby require 'ewelink' api = Ewelink::Api.new(phone_number: '+687 414243', password: 'secr$t') api.turn_switch!(switch[:uuid], :on) api.turn_switch!(switch[:uuid], :off) ``` Or : ```ruby api.turn_switch!(switch[:uuid], true) api.turn_switch!(switch[:uuid], false) ``` ### Check if switch is on ```ruby require 'ewelink' api = Ewelink::Api.new(phone_number: '+687 414243', password: 'secr$t') puts api.switch_on?(switch[:uuid]) ``` ### Press RF bridge button ```ruby require 'ewelink' api = Ewelink::Api.new(email: 'john@example.com', password: 'secr$t') api.press_rf_bridge_button!(button[:uuid]) ``` ### Additional options - `async_actions` (`true` | `false`): To perform actions (pressing an RF bridge button or turning a switch on/off) in asynchronous mode. (default: `false`). - `update_devices_status_on_connect` (`true` | `false`): To update devices status (on, off) when connecting to Ewelink API (default: `false`). ### Configuring logger In order to have some debug informations about what kagu does, you could configure its logger: ```ruby Ewelink.logger = Logger.new(STDERR) ``` ### Executable This gem also provides a `ewelink` executable, just run it with `--help` option to get all available options.
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
ewelink-5.0.0 | README.mdown |
ewelink-4.1.0 | README.mdown |
ewelink-4.0.0 | README.mdown |
ewelink-3.3.2 | README.mdown |
ewelink-3.3.1 | README.mdown |
ewelink-3.3.0 | README.mdown |