Giter VIP home page Giter VIP logo

orvibo-ruby's Introduction

Orvibo-s20 for Ruby

This is a fork of https://github.com/Corona4456/orvibo-ruby
Its readme was incorrect/outdated, as the installation instructions fail, the gem was never published to RubyGems.

Build and Install Gem

gem build orvibo-ruby.gemspec
gem install orvibo-s20-0.1.0.gem

Usage (example)

require 'orvibo-s20'

# create the manager object
manager = OrviboS20.new(broadcast_address = '192.168.0.255', timeout = 2)

# call out to all Orvibo S20's on the broadcast Subnet. Returns a Hash of each device found.
# the key is the ip address, the value are the sockets details.
manager.discoverOutlets()

# get a specific OrviboS20Outlet
outlet = manager.discoverOutlets()["192.168.0.241"] 

# use the manager to link with the outlet (subscribe), then toggle it on and off.
manager.subscribe(outlet); manager.powerOn(outlet); sleep 5; manager.subscribe(outlet); manager.powerOff(outlet)

Subscription Details / Quirks

Its possible to get away without calling subscribe on the outlet before each call, but it seems more reliable to do so.

Without a valid subscription, the Orvibo will ignore any request. For my (single) use case, the few seconds required to establish a fresh subscription are fine. If you are using an Orvibo to cycle something on and off at very sort intervals. I'd suspect the relay in the Orvibo would give out, and your connected appliance may be unhappy as well!

I'm sure there is a more exact science to it, but as stated my use case does not call for it, and it wasnt implemented in the original project, so I have not investigated.

License

The gem is available as open source under the terms of the MIT License.

orvibo-ruby's People

Contributors

ryanhattam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.