class Sensor
Represent Hue
Sensors
Attributes
detail[R]
name[R]
on[R]
Public Class Methods
new(key, hashvalue)
click to toggle source
Calls superclass method
HueResource::new
# File lib/ha/sensor.rb, line 7 def initialize(key, hashvalue) super key = analyze_detail @detail @on = hashvalue.dig("state", key) gen_reskey("s") @state.merge! ({"on" => @on}) end
Public Instance Methods
analyze_detail(detail)
click to toggle source
# File lib/ha/sensor.rb, line 19 def analyze_detail detail key = "status" if detail == "CLIPPresence" key = "presence" elsif detail == "Geofence" key = "presence" elsif detail == "CLIPGenericFlag" key = "flag" elsif detail == "Daylight" key = "daylight" end key end
array(selectors)
click to toggle source
# File lib/ha/sensor.rb, line 15 def array(selectors) selectors.map { |key| @state[key] } end