lex-esphome 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -15
- data/Dockerfile +10 -0
- data/README.md +17 -0
- data/bitbucket-pipelines.yml +21 -0
- data/docker_deploy.rb +13 -0
- data/lex-esphome.gemspec +0 -6
- data/lib/legion/extensions/esphome.rb +1 -2
- data/lib/legion/extensions/esphome/runners/logs.rb +2 -2
- data/lib/legion/extensions/esphome/runners/sensors.rb +5 -5
- data/lib/legion/extensions/esphome/version.rb +1 -1
- metadata +9 -79
- data/.travis.yml +0 -6
- data/bin/console +0 -15
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 363163615836076faf1fc4ec3460426f636dbb4c058250693a99bad2c9bfc9e6
|
4
|
+
data.tar.gz: fffe31eae987fd62a2ac93ee49daa7ba6653430bf234a10688de2ec64ea43be2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8bad6d1aad3a4c0ced503036c5e5363e27bb1337eda53fccd55953dc98077fde49643b726e9469c2825dc8f6ccc4fb78e8b84636fef37862afeab1db9b05a02
|
7
|
+
data.tar.gz: b1d148e3a04567ffeaf2f7af532b7f6ae7cdf1df76d87a5f6014ac57872031b25dbc581d371e35cb00545b53d3f9e04c1dfd5e53dede98240b707677dc9e87f6
|
data/.rubocop.yml
CHANGED
@@ -2,27 +2,13 @@ Layout/LineLength:
|
|
2
2
|
Max: 120
|
3
3
|
Metrics/MethodLength:
|
4
4
|
Max: 50
|
5
|
-
Metrics/ClassLength:
|
6
|
-
Max: 1500
|
7
|
-
Metrics/BlockLength:
|
8
|
-
Max: 50
|
9
|
-
Metrics/AbcSize:
|
10
|
-
Max: 30
|
11
|
-
Layout/SpaceAroundEqualsInParameterDefault:
|
12
|
-
EnforcedStyle: space
|
13
|
-
Style/SymbolArray:
|
14
|
-
Enabled: true
|
15
|
-
Layout/HashAlignment:
|
16
|
-
EnforcedHashRocketStyle: table
|
17
|
-
EnforcedColonStyle: table
|
18
5
|
Style/Documentation:
|
19
6
|
Enabled: false
|
20
7
|
AllCops:
|
21
8
|
TargetRubyVersion: 2.5
|
22
9
|
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
23
11
|
Style/FrozenStringLiteralComment:
|
24
12
|
Enabled: false
|
25
|
-
Naming/FileName:
|
26
|
-
Enabled: false
|
27
13
|
Style/ClassAndModuleChildren:
|
28
14
|
Enabled: false
|
data/Dockerfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
FROM ruby:2.7-alpine
|
2
|
+
LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"
|
3
|
+
|
4
|
+
RUN mkdir /etc/legionio
|
5
|
+
RUN apk update && apk add build-base tzdata gcc git
|
6
|
+
|
7
|
+
COPY . ./
|
8
|
+
RUN gem install legionio tzinfo-data tzinfo --no-document --no-prerelease
|
9
|
+
RUN gem install lex-esphome --no-document --no-prerelease
|
10
|
+
CMD legionio
|
data/README.md
CHANGED
@@ -82,6 +82,23 @@ There are two passive runners within this Lex. One to process log entries, the o
|
|
82
82
|
|Logs|process|required|required|X|
|
83
83
|
|Sensors|process|required|required|optional|
|
84
84
|
|
85
|
+
## Relationship examples
|
86
|
+
Send the data to an [InfluxDB](https://github.com/influxdata/influxdb) instance. Requires [Legion::Extensions::Influxdb](https://rubygems.org/gems/lex-influxdb)
|
87
|
+
```json
|
88
|
+
{
|
89
|
+
"name": "esphome sensor to influxdb",
|
90
|
+
"enabled": 1,
|
91
|
+
"transformation": "{
|
92
|
+
"host": "localhost",
|
93
|
+
"port": 8086,
|
94
|
+
"database": "esphome",
|
95
|
+
"metrics": "{
|
96
|
+
\"values\":{\"<%= results[:sub_type] %>\":<%= results[:value].to_f %>},
|
97
|
+
\"tags\":{\"name\":\"<%= results[:name] %>\", \"type\": \"<%= results[:type] %>\",\"sub_type\": \"<%= results[:sub_type] %>\",\"item\": \"<%= results[:item] %>\"}
|
98
|
+
}",
|
99
|
+
}"
|
100
|
+
}
|
101
|
+
```
|
85
102
|
|
86
103
|
## Development
|
87
104
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
image: ruby:2.7
|
2
|
+
|
3
|
+
pipelines:
|
4
|
+
tags:
|
5
|
+
"v*":
|
6
|
+
- step:
|
7
|
+
name: Push to RubyGems
|
8
|
+
deployment: RubyGems
|
9
|
+
script:
|
10
|
+
- gem install gem-release
|
11
|
+
- (umask 077 ; echo $gem_creds | base64 --decode > ~/.gem/credentials)
|
12
|
+
- gem release
|
13
|
+
artifacts:
|
14
|
+
- pkg/**
|
15
|
+
- step:
|
16
|
+
name: Push to Docker
|
17
|
+
deployment: Docker
|
18
|
+
script:
|
19
|
+
- 'apt-get update'
|
20
|
+
- 'apt-get install -y docker'
|
21
|
+
- './docker_deploy.rb'
|
data/docker_deploy.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
name = 'esphome'
|
4
|
+
require "./lib/legion/extensions/#{name}/version"
|
5
|
+
version = Legion::Extensions::Esphome::VERSION
|
6
|
+
|
7
|
+
puts "Building docker image for Legion v#{version}"
|
8
|
+
system("docker build --tag legionio/lex-#{name}:v#{version} .")
|
9
|
+
puts 'Pushing to hub.docker.com'
|
10
|
+
system("docker push legionio/lex-#{name}:v#{version}")
|
11
|
+
system("docker tag legionio/lex-#{name}:v#{version} legionio/lex-#{name}:latest")
|
12
|
+
system("docker push legionio/lex-#{name}:latest")
|
13
|
+
puts 'completed'
|
data/lex-esphome.gemspec
CHANGED
@@ -19,16 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
20
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
21
|
end
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
26
|
-
spec.add_development_dependency 'codecov'
|
27
24
|
spec.add_development_dependency 'rake'
|
28
25
|
spec.add_development_dependency 'rspec'
|
29
26
|
spec.add_development_dependency 'rspec_junit_formatter'
|
30
27
|
spec.add_development_dependency 'rubocop'
|
31
|
-
spec.add_development_dependency 'rubocop-md'
|
32
|
-
spec.add_development_dependency 'rubocop-performance'
|
33
|
-
spec.add_development_dependency 'rubocop-rspec'
|
34
28
|
end
|
@@ -5,8 +5,8 @@ module Legion
|
|
5
5
|
module Logs
|
6
6
|
def self.process(value:, **payload)
|
7
7
|
{
|
8
|
-
log:
|
9
|
-
location:
|
8
|
+
log: value.gsub(/\e\[([;\d]+)?m/, ''),
|
9
|
+
location: payload[:routing_key].split('.').last,
|
10
10
|
timestamp_in_ms: payload[:timestamp_in_ms]
|
11
11
|
}
|
12
12
|
end
|
@@ -40,11 +40,11 @@ module Legion
|
|
40
40
|
end
|
41
41
|
|
42
42
|
{
|
43
|
-
value:
|
44
|
-
name:
|
45
|
-
type:
|
46
|
-
sub_type:
|
47
|
-
item:
|
43
|
+
value: value,
|
44
|
+
name: items[0],
|
45
|
+
type: items[2],
|
46
|
+
sub_type: subtype,
|
47
|
+
item: items[3],
|
48
48
|
timestamp_in_ms: payload[:timestamp_in_ms]
|
49
49
|
}
|
50
50
|
end
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lex-esphome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esity
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: codecov
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: rake
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,48 +66,6 @@ dependencies:
|
|
94
66
|
- - ">="
|
95
67
|
- !ruby/object:Gem::Version
|
96
68
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-md
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-performance
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
69
|
description: Used to connect Legion to Esphome
|
140
70
|
email:
|
141
71
|
- matthewdiverson@gmail.com
|
@@ -146,14 +76,14 @@ files:
|
|
146
76
|
- ".gitignore"
|
147
77
|
- ".rspec"
|
148
78
|
- ".rubocop.yml"
|
149
|
-
- ".travis.yml"
|
150
79
|
- CODE_OF_CONDUCT.md
|
80
|
+
- Dockerfile
|
151
81
|
- Gemfile
|
152
82
|
- LICENSE.txt
|
153
83
|
- README.md
|
154
84
|
- Rakefile
|
155
|
-
-
|
156
|
-
-
|
85
|
+
- bitbucket-pipelines.yml
|
86
|
+
- docker_deploy.rb
|
157
87
|
- lex-esphome.gemspec
|
158
88
|
- lib/legion/extensions/esphome.rb
|
159
89
|
- lib/legion/extensions/esphome/actors/logs.rb
|
@@ -169,7 +99,7 @@ metadata:
|
|
169
99
|
homepage_uri: https://bitbucket.org/legion-io/lex-esphome
|
170
100
|
source_code_uri: https://bitbucket.org/legion-io/lex-esphome
|
171
101
|
changelog_uri: https://bitbucket.org/legion-io/lex-esphome/src/master/CHANGELOG.md
|
172
|
-
post_install_message:
|
102
|
+
post_install_message:
|
173
103
|
rdoc_options: []
|
174
104
|
require_paths:
|
175
105
|
- lib
|
@@ -184,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
114
|
- !ruby/object:Gem::Version
|
185
115
|
version: '0'
|
186
116
|
requirements: []
|
187
|
-
rubygems_version: 3.1.
|
188
|
-
signing_key:
|
117
|
+
rubygems_version: 3.1.4
|
118
|
+
signing_key:
|
189
119
|
specification_version: 4
|
190
120
|
summary: LEX::Esphome
|
191
121
|
test_files: []
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'legion/extensions/esphome'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|