Class: SAAL::Denkovi::Outlet
- Inherits:
-
SensorUnderlying
- Object
- SensorUnderlying
- SAAL::Denkovi::Outlet
- Defined in:
- lib/denkovi.rb
Instance Method Summary collapse
-
#initialize(num, outletgroup) ⇒ Outlet
constructor
A new instance of Outlet.
- #read(uncached = false) ⇒ Object
- #sensor_type ⇒ Object
- #write(value) ⇒ Object
Methods inherited from SensorUnderlying
Constructor Details
#initialize(num, outletgroup) ⇒ Outlet
Returns a new instance of Outlet.
9 10 11 12 |
# File 'lib/denkovi.rb', line 9 def initialize(num, outletgroup) @num = num @og = outletgroup end |
Instance Method Details
#read(uncached = false) ⇒ Object
18 19 20 |
# File 'lib/denkovi.rb', line 18 def read(uncached = false) {'ON' => 1.0, 'OFF' => 0.0}[@og.state(@num)] end |
#sensor_type ⇒ Object
14 15 16 |
# File 'lib/denkovi.rb', line 14 def sensor_type :onoff end |
#write(value) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/denkovi.rb', line 22 def write(value) newstate = {1.0 => 'ON', 0.0 => 'OFF'}[value] if newstate @og.set_state(@num,newstate) value end end |