Class: Fritzbox::Smarthome::Switch
- Includes:
- Properties::SimpleOnOff
- Defined in:
- lib/fritzbox/smarthome/switch.rb
Constant Summary
Constants inherited from Actor
Constants inherited from Resource
Instance Attribute Summary collapse
-
#powermeter_energy ⇒ Object
Returns the value of attribute powermeter_energy.
-
#powermeter_power ⇒ Object
Returns the value of attribute powermeter_power.
-
#powermeter_voltage ⇒ Object
Returns the value of attribute powermeter_voltage.
-
#switch_devicelock ⇒ Object
Returns the value of attribute switch_devicelock.
-
#switch_lock ⇒ Object
Returns the value of attribute switch_lock.
-
#switch_mode ⇒ Object
Returns the value of attribute switch_mode.
-
#switch_state ⇒ Object
Returns the value of attribute switch_state.
-
#temperature_celsius ⇒ Object
Returns the value of attribute temperature_celsius.
-
#temperature_offset ⇒ Object
Returns the value of attribute temperature_offset.
Attributes inherited from Actor
#ain, #group_members, #id, #manufacturer, #name, #present, #type
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Properties::SimpleOnOff
Methods inherited from Actor
all, find_by!, new_from_api, #reload
Methods inherited from Resource
Instance Attribute Details
#powermeter_energy ⇒ Object
Returns the value of attribute powermeter_energy.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def powermeter_energy @powermeter_energy end |
#powermeter_power ⇒ Object
Returns the value of attribute powermeter_power.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def powermeter_power @powermeter_power end |
#powermeter_voltage ⇒ Object
Returns the value of attribute powermeter_voltage.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def powermeter_voltage @powermeter_voltage end |
#switch_devicelock ⇒ Object
Returns the value of attribute switch_devicelock.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def switch_devicelock @switch_devicelock end |
#switch_lock ⇒ Object
Returns the value of attribute switch_lock.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def switch_lock @switch_lock end |
#switch_mode ⇒ Object
Returns the value of attribute switch_mode.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def switch_mode @switch_mode end |
#switch_state ⇒ Object
Returns the value of attribute switch_state.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def switch_state @switch_state end |
#temperature_celsius ⇒ Object
Returns the value of attribute temperature_celsius.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def temperature_celsius @temperature_celsius end |
#temperature_offset ⇒ Object
Returns the value of attribute temperature_offset.
7 8 9 |
# File 'lib/fritzbox/smarthome/switch.rb', line 7 def temperature_offset @temperature_offset end |
Class Method Details
.match?(data) ⇒ Boolean
19 20 21 |
# File 'lib/fritzbox/smarthome/switch.rb', line 19 def match?(data) data.key?('switch') end |
Instance Method Details
#assign_from_api(data) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fritzbox/smarthome/switch.rb', line 24 def assign_from_api(data) super(data) assign_attributes( switch_state: data.dig('switch', 'state').to_i, switch_mode: data.dig('switch', 'mode').to_s, switch_lock: data.dig('switch', 'lock').to_i, switch_devicelock: data.dig('switch', 'devicelock').to_i, powermeter_voltage: data.dig('powermeter', 'voltage').to_i, powermeter_power: data.dig('powermeter', 'power').to_i, powermeter_energy: data.dig('powermeter', 'energy').to_i, temperature_celsius: data.dig('temperature', 'celsius').to_i, temperature_offset: data.dig('temperature', 'offset').to_i ) end |