Class: Sappho::Heatmiser::Proxy::HeatmiserStatus::TimedTemperature

Inherits:
Object
  • Object
show all
Defined in:
lib/sappho-heatmiser-proxy/heatmiser_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw, bytePosition) ⇒ TimedTemperature

Returns a new instance of TimedTemperature.



26
27
28
29
30
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 26

def initialize raw, bytePosition
  @hour = raw[bytePosition] & 0xFF
  @minute = raw[bytePosition + 1] & 0xFF
  @temperature = raw[bytePosition + 2] & 0xFF
end

Instance Attribute Details

#hourObject (readonly)

Returns the value of attribute hour.



24
25
26
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 24

def hour
  @hour
end

#minuteObject (readonly)

Returns the value of attribute minute.



24
25
26
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 24

def minute
  @minute
end

#temperatureObject (readonly)

Returns the value of attribute temperature.



24
25
26
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 24

def temperature
  @temperature
end

Instance Method Details

#descriptionObject



36
37
38
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 36

def description
  "#{@hour}:#{@minute}-#{@temperature}"
end

#valid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/sappho-heatmiser-proxy/heatmiser_status.rb', line 32

def valid?
  @hour < 24 and @minute < 60
end