Class: Tado::Device
- Inherits:
-
Object
- Object
- Tado::Device
- Defined in:
- lib/tado/device.rb
Overview
Class wrapping interaction with the Tado Device
Instance Attribute Summary collapse
-
#battery ⇒ :NORMAL
readonly
Battery status.
-
#calibrated ⇒ nil, Time
readonly
Time of device calilbration.
-
#capabilities ⇒ Array<Symbol>
readonly
Capabilities.
-
#connection ⇒ nil, Time
readonly
Time of last connection.
-
#duties ⇒ Array<Symbol>
readonly
Duties performed by the device.
-
#firmware ⇒ String
readonly
Current firmware version.
-
#serial ⇒ String
readonly
Serial number of device.
-
#type ⇒ :HEATING, Symbol
readonly
Type of device (heating, airconditioning).
Class Method Summary collapse
-
.from_json(json, zone:) ⇒ Object
Create a device instance associated to the zone from the JSON returned by the Tado API.
Instance Method Summary collapse
-
#initialize(serial, data: nil, zone:) ⇒ Device
constructor
Create a device instance associated to the zone.
Constructor Details
#initialize(serial, data: nil, zone:) ⇒ Device
Create a device instance associated to the zone
80 81 82 83 84 85 |
# File 'lib/tado/device.rb', line 80 def initialize(serial, data: nil, zone:) @zone = zone @serial = serial data&.each {|k, v| instance_variable_set("@#{k}", v) } end |
Instance Attribute Details
#battery ⇒ :NORMAL (readonly)
Battery status
50 51 52 |
# File 'lib/tado/device.rb', line 50 def battery @battery end |
#calibrated ⇒ nil, Time (readonly)
Time of device calilbration
65 66 67 |
# File 'lib/tado/device.rb', line 65 def calibrated @calibrated end |
#capabilities ⇒ Array<Symbol> (readonly)
Capabilities
58 59 60 |
# File 'lib/tado/device.rb', line 58 def capabilities @capabilities end |
#connection ⇒ nil, Time (readonly)
Time of last connection
72 73 74 |
# File 'lib/tado/device.rb', line 72 def connection @connection end |
#duties ⇒ Array<Symbol> (readonly)
Duties performed by the device
44 45 46 |
# File 'lib/tado/device.rb', line 44 def duties @duties end |
#firmware ⇒ String (readonly)
Current firmware version
35 36 37 |
# File 'lib/tado/device.rb', line 35 def firmware @firmware end |
#serial ⇒ String (readonly)
Serial number of device
22 23 24 |
# File 'lib/tado/device.rb', line 22 def serial @serial end |
#type ⇒ :HEATING, Symbol (readonly)
Type of device (heating, airconditioning)
29 30 31 |
# File 'lib/tado/device.rb', line 29 def type @type end |
Class Method Details
.from_json(json, zone:) ⇒ Object
Create a device instance associated to the zone from the JSON returned by the Tado API
12 13 14 15 16 |
# File 'lib/tado/device.rb', line 12 def self.from_json(json, zone:) self.new(json.dig('serialNo'), data: self.parse_from_json(json), zone: zone) end |