Class: Fritzbox::Smarthome::SmokeDetector
- Inherits:
-
Actor
show all
- Defined in:
- lib/fritzbox/smarthome/smoke_detector.rb
Constant Summary
Constants inherited
from Actor
Actor::ResourceNotFound
Constants inherited
from Resource
Resource::AuthenticationError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Actor
all, find_by!, new_from_api, #reload
Methods inherited from Resource
get, parse
Class Method Details
.match?(data) ⇒ Boolean
8
9
10
|
# File 'lib/fritzbox/smarthome/smoke_detector.rb', line 8
def match?(data)
data.key?('alert')
end
|
Instance Method Details
#assign_from_api(data) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/fritzbox/smarthome/smoke_detector.rb', line 13
def assign_from_api(data)
super(data)
assign_attributes(
alert_state: data.dig('alert', 'state').to_i,
last_alert: Time.at(data.dig('alert', 'lastalertchgtimestamp').to_i)
)
end
|