fritzbox-smarthome 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/fritzbox-smarthome.gemspec +3 -2
- data/lib/fritzbox/smarthome/actor.rb +8 -8
- data/lib/fritzbox/smarthome/heater.rb +6 -8
- data/lib/fritzbox/smarthome/lightbulb.rb +0 -3
- data/lib/fritzbox/smarthome/null_logger.rb +0 -2
- data/lib/fritzbox/smarthome/properties/simple_on_off.rb +5 -6
- data/lib/fritzbox/smarthome/properties.rb +1 -4
- data/lib/fritzbox/smarthome/smoke_detector.rb +2 -4
- data/lib/fritzbox/smarthome/switch.rb +18 -20
- data/lib/fritzbox/smarthome/version.rb +1 -1
- data/lib/fritzbox/smarthome.rb +6 -6
- metadata +25 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ea6ed68d8e2192e09bcb904d927fe415b4a83174496f73f2afb57ce3836780f
|
4
|
+
data.tar.gz: 63944795b9c64f8a0389aa95bd234b2c42a37972580360c6722caf3b80166ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b9d64dbf43c0cb0003944d205da74d5ea3164837f81afb111bdd99660c8e9716ce5f1151fc22a8640f35770f4be51c28116e60801c90b6d718d5584776c782
|
7
|
+
data.tar.gz: 5b5a06172b88d899d0c226dcf040d327ecc18075fc1d893f38d83d04deae1a74564bbe2b3d5517896f1b59bc722deee20b46bd1166122de82ed0993cbdc060a2
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.3
|
data/CHANGELOG.md
CHANGED
data/fritzbox-smarthome.gemspec
CHANGED
@@ -20,8 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'activesupport', '>=
|
24
|
-
spec.add_dependency 'activemodel', '>=
|
23
|
+
spec.add_dependency 'activesupport', '>= 7.0', '<= 8'
|
24
|
+
spec.add_dependency 'activemodel', '>= 7.0', '<= 8'
|
25
|
+
spec.add_dependency 'csv', '~> 3.2' # For httparty to silence deprecation warning in ruby >= 3.3.0
|
25
26
|
spec.add_dependency 'httparty', '~> 0.20'
|
26
27
|
spec.add_dependency 'nori', '~> 2.6'
|
27
28
|
spec.add_dependency 'nokogiri', '~> 1.13'
|
@@ -2,15 +2,15 @@ module Fritzbox
|
|
2
2
|
module Smarthome
|
3
3
|
class Actor < Resource
|
4
4
|
include ActiveModel::Model
|
5
|
+
include ActiveModel::Attributes
|
5
6
|
|
6
|
-
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:group_members
|
7
|
+
attribute :id, :string
|
8
|
+
attribute :type #, :symbol
|
9
|
+
attribute :ain, :string
|
10
|
+
attribute :present, :string
|
11
|
+
attribute :name, :string
|
12
|
+
attribute :manufacturer, :string
|
13
|
+
attribute :group_members #, :string, array: true
|
14
14
|
|
15
15
|
ResourceNotFound = Class.new(RuntimeError)
|
16
16
|
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module Fritzbox
|
2
2
|
module Smarthome
|
3
3
|
class Heater < Actor
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
:hkr_next_change_period,
|
11
|
-
:hkr_next_change_temp
|
4
|
+
attribute :battery, :integer
|
5
|
+
attribute :batterylow, :integer
|
6
|
+
attribute :hkr_temp_is, :float
|
7
|
+
attribute :hkr_temp_set, :float
|
8
|
+
attribute :hkr_next_change_period, :time
|
9
|
+
attribute :hkr_next_change_temp, :float
|
12
10
|
|
13
11
|
class << self
|
14
12
|
def match?(data)
|
@@ -9,20 +9,20 @@ module Fritzbox
|
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
included do
|
12
|
-
|
12
|
+
attribute :simpleonoff_state, :integer
|
13
13
|
end
|
14
14
|
|
15
15
|
module ClassMethods
|
16
16
|
def new_from_api(data)
|
17
17
|
instance = defined?(super) ? super : new
|
18
|
-
instance.simpleonoff_state = data.dig('simpleonoff', 'state')
|
18
|
+
instance.simpleonoff_state = data.dig('simpleonoff', 'state')
|
19
19
|
instance
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
# @return [Boolean]
|
24
24
|
def active?
|
25
|
-
simpleonoff_state
|
25
|
+
simpleonoff_state == 1
|
26
26
|
end
|
27
27
|
|
28
28
|
# Makes a request to the Fritzbox and set the current instance's active state.
|
@@ -43,10 +43,9 @@ module Fritzbox
|
|
43
43
|
def toggle!
|
44
44
|
raise ArgumentError, "Attribute `ain` is missing on #{inspect}" unless respond_to?(:ain)
|
45
45
|
value = active? ? 0 : 1
|
46
|
-
response =
|
47
|
-
Fritzbox::Smarthome::Resource.get(command: 'setsimpleonoff', ain: ain, onoff: value)
|
46
|
+
response = Fritzbox::Smarthome::Resource.get(command: 'setsimpleonoff', ain: ain, onoff: value)
|
48
47
|
|
49
|
-
response.ok? &&
|
48
|
+
response.ok? && self.simpleonoff_state = value
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
@@ -1,19 +1,17 @@
|
|
1
1
|
module Fritzbox
|
2
2
|
module Smarthome
|
3
3
|
class Switch < Actor
|
4
|
-
|
5
4
|
include Properties::SimpleOnOff
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
:temperature_offset
|
6
|
+
attribute :switch_state, :integer
|
7
|
+
attribute :switch_mode, :string
|
8
|
+
attribute :switch_lock, :integer
|
9
|
+
attribute :switch_devicelock, :integer
|
10
|
+
attribute :powermeter_voltage, :integer
|
11
|
+
attribute :powermeter_power, :integer
|
12
|
+
attribute :powermeter_energy, :integer
|
13
|
+
attribute :temperature_celsius, :integer
|
14
|
+
attribute :temperature_offset, :integer
|
17
15
|
|
18
16
|
class << self
|
19
17
|
def match?(data)
|
@@ -25,15 +23,15 @@ module Fritzbox
|
|
25
23
|
super(data)
|
26
24
|
|
27
25
|
assign_attributes(
|
28
|
-
switch_state: data.dig('switch', 'state')
|
29
|
-
switch_mode: data.dig('switch', 'mode')
|
30
|
-
switch_lock: data.dig('switch', 'lock')
|
31
|
-
switch_devicelock: data.dig('switch', 'devicelock')
|
32
|
-
powermeter_voltage: data.dig('powermeter', 'voltage')
|
33
|
-
powermeter_power: data.dig('powermeter', 'power')
|
34
|
-
powermeter_energy: data.dig('powermeter', 'energy')
|
35
|
-
temperature_celsius: data.dig('temperature', 'celsius')
|
36
|
-
temperature_offset: data.dig('temperature', 'offset')
|
26
|
+
switch_state: data.dig('switch', 'state'),
|
27
|
+
switch_mode: data.dig('switch', 'mode'),
|
28
|
+
switch_lock: data.dig('switch', 'lock'),
|
29
|
+
switch_devicelock: data.dig('switch', 'devicelock'),
|
30
|
+
powermeter_voltage: data.dig('powermeter', 'voltage'),
|
31
|
+
powermeter_power: data.dig('powermeter', 'power'),
|
32
|
+
powermeter_energy: data.dig('powermeter', 'energy'),
|
33
|
+
temperature_celsius: data.dig('temperature', 'celsius'),
|
34
|
+
temperature_offset: data.dig('temperature', 'offset')
|
37
35
|
)
|
38
36
|
end
|
39
37
|
end
|
data/lib/fritzbox/smarthome.rb
CHANGED
@@ -18,13 +18,13 @@ module Fritzbox
|
|
18
18
|
module Smarthome
|
19
19
|
class Configuration
|
20
20
|
include ActiveModel::Model
|
21
|
+
include ActiveModel::Attributes
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
:logger
|
23
|
+
attribute :endpoint, :string
|
24
|
+
attribute :username, :string
|
25
|
+
attribute :password, :string
|
26
|
+
attribute :verify_ssl, :boolean
|
27
|
+
attribute :logger
|
28
28
|
end
|
29
29
|
|
30
30
|
@config = Configuration.new.tap do |defaults|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fritzbox-smarthome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaus Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,40 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
20
|
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '7.0'
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activemodel
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '7.0'
|
40
40
|
- - "<="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '8'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '7.0'
|
50
50
|
- - "<="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '8'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: csv
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3.2'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.2'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: httparty
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
213
|
- !ruby/object:Gem::Version
|
200
214
|
version: '0'
|
201
215
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.5.11
|
203
217
|
signing_key:
|
204
218
|
specification_version: 4
|
205
219
|
summary: Client library to interface with Smarthome features of your FritzBox
|