Project

ewelink

0.0
Low commit activity in last 3 years
No release in over a year
Manage eWeLink smart home devices
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 11.0.0, < 12.0.0
>= 13.0.0, < 14.0.0
>= 1.25.0, < 2.0.0
>= 0.6.0, < 1.0.0

Runtime

>= 0.2.0, < 0.3.0
>= 7.0.0, < 8.0.0
>= 0.20.0, < 0.21.0
 Project Readme

Ewelink

Ruby API to manage eWeLink smart home devices.

Installation

Just add this into your Gemfile:

gem 'ewelink'

Then, just run bundle install.

Examples

Displaying all switches

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

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

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 :

api.turn_switch!(switch[:uuid], true)
api.turn_switch!(switch[:uuid], false)

Check if switch is on

require 'ewelink'

api = Ewelink::Api.new(phone_number: '+687 414243', password: 'secr$t')
puts api.switch_on?(switch[:uuid])

Press RF bridge button

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:

Ewelink.logger = Logger.new(STDERR)

Executable

This gem also provides a ewelink executable, just run it with --help option to get all available options.