home_assistant-generator 0.1.0.pre.alpha.pre.13 → 0.1.0.pre.alpha.pre.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/example_config.rb +12 -15
- data/lib/home_assistant/generator/dsl.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e211bd4bbfc0febec543643070ea59ef6465ae1
|
4
|
+
data.tar.gz: d3ad629f5d8d12a2845f0de13a5eeee0c06fa1cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2af5b10939713fc6c6e1f51d7f9309c20da0b4f32858fc91955038a1f9f0adfd32a18b494cbe70610ae266e5ff48412f7c9d4216b81d2e296001f09fefe738e1
|
7
|
+
data.tar.gz: 1e3499e9571018686f3f1b790a170e5fa51ba75d5b71be2d48491c5b59a69fe13156a1d8917c0b20fdee306c85c0541e5adf8f51884bbefb7d11b549f74d4b59
|
data/example_config.rb
CHANGED
@@ -32,35 +32,33 @@ updater do
|
|
32
32
|
reporting 'no'
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
yr__sensor
|
36
|
+
# strictly equivalent to:
|
37
|
+
#sensor do
|
38
|
+
# platform :yr
|
39
|
+
#end
|
40
|
+
|
38
41
|
|
39
|
-
|
40
|
-
platform :speedtest
|
42
|
+
speedtest__sensor do
|
41
43
|
monitored_conditions %w(ping)
|
42
44
|
#hour [0, 6, 12, 18]
|
43
45
|
#minute 5
|
44
46
|
end
|
45
47
|
|
46
|
-
|
47
|
-
platform :darksky
|
48
|
+
darksky__sensor do
|
48
49
|
api_key 'FAKE_KEY'
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
-
platform :statistics
|
52
|
+
statistics__sensor 'Ping Stats' do
|
53
53
|
entity_id 'sensor.speedtest_ping'
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
platform :waqi
|
56
|
+
waqi__sensor do
|
58
57
|
locations %w(paris)
|
59
58
|
stations ['place victor basch']
|
60
59
|
end
|
61
60
|
|
62
|
-
|
63
|
-
platform :nmap_tracker
|
61
|
+
nmap_tracker__device_tracker do
|
64
62
|
hosts '192.168.0.0/24'
|
65
63
|
home_interval 10
|
66
64
|
interval_seconds 120
|
@@ -73,8 +71,7 @@ zone 'Criteo' do
|
|
73
71
|
icon 'mdi:desktop-tower'
|
74
72
|
end
|
75
73
|
|
76
|
-
|
77
|
-
platform :limitlessled
|
74
|
+
limitless__light do
|
78
75
|
bridges([
|
79
76
|
{ host: '192.168.0.110', groups: [{ number: 1, type: 'rgbw', name: 'Table à manger' }] }
|
80
77
|
])
|
@@ -51,14 +51,22 @@ module HomeAssistant
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def method_missing(name, *args, &block)
|
54
|
-
|
54
|
+
klass_parts = name.to_s.split('__')
|
55
|
+
klass_name = klass_parts.pop.camel_case
|
56
|
+
|
57
|
+
platform = klass_parts.pop
|
58
|
+
|
59
|
+
super unless args.one? || # one arg means it's the name
|
60
|
+
Component::EMPTY_CONF_ALLOWED.include?(name) || # some components don't have configuration
|
61
|
+
block_given? || # some component don't have a name
|
62
|
+
platform # some component simply have a platform and no additional conf
|
55
63
|
|
56
|
-
klass_name = name.to_s.camel_case
|
57
64
|
unless DSL.const_defined?(klass_name)
|
58
65
|
debug("No #{klass_name} class, defining dynamic class")
|
59
66
|
DSL.const_set(klass_name, Class.new(Component) {})
|
60
67
|
end
|
61
68
|
element = DSL.const_get(klass_name).new(*args)
|
69
|
+
element.send(:platform, platform) if platform
|
62
70
|
component_list << element
|
63
71
|
element.instance_eval(&block) if block_given?
|
64
72
|
element
|