awair 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/awair_mqtt_bridge +58 -11
- metadata +23 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce8d30d13d9d8b60c466ebc147fb669ede41ffd027cacb6e33d90eaf46824a4f
|
4
|
+
data.tar.gz: debd26604af53badc92938a14a1e6d8e3e98973ee7ba25802ae914e6125f5f7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cd9d755e83fefca0c5c789c95147f12d292751de7ddaa4baacf125b7fed74b53d946ea83cd217f4762feb7f305bf82223d34ace92005180a2c20f5261928bcc
|
7
|
+
data.tar.gz: '048f27b5cedaf24b27cf82797d48d1e0e59eb3c89335513e714e9b98dbd71d7a1fe310177449d6811a68d82be6752365ac91822b2f4deb255bab1e015aa51394'
|
data/exe/awair_mqtt_bridge
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "faraday_middleware"
|
5
|
-
require "
|
5
|
+
require "mqtt-homeassistant"
|
6
6
|
require "optparse"
|
7
7
|
|
8
8
|
refresh = 30.0
|
@@ -40,18 +40,65 @@ unit = fahrenheit ? "°F" : "°C"
|
|
40
40
|
def convert_unit(number, use_fahrenheit)
|
41
41
|
return number unless use_fahrenheit
|
42
42
|
|
43
|
-
number * 9 / 5 + 32
|
43
|
+
(number * 9 / 5).round(2) + 32
|
44
44
|
end
|
45
45
|
|
46
|
-
homie = MQTT::Homie::Device.new(MQTT::Homie.escape_id(config["device_uuid"]), "Awair Sensor", mqtt: ARGV[1])
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
device.
|
52
|
-
device.property("
|
53
|
-
|
54
|
-
|
46
|
+
homie = MQTT::Homie::Device.new(MQTT::Homie.escape_id(config["device_uuid"]), "Awair Air Quality Sensor", mqtt: ARGV[1])
|
47
|
+
homie.home_assistant_device = {
|
48
|
+
manufacturer: "Awair Inc.",
|
49
|
+
sw_version: config["fw_version"]
|
50
|
+
}
|
51
|
+
device = homie.node("device", "Awair Air Quality Sensor", "Device")
|
52
|
+
device.property("score",
|
53
|
+
"Air Quality Score",
|
54
|
+
:integer,
|
55
|
+
data["score"],
|
56
|
+
format: 0..100,
|
57
|
+
unit: "%",
|
58
|
+
hass: { sensor: { icon: "mdi:counter",
|
59
|
+
state_class: :measurement } })
|
60
|
+
device.property("dewpoint",
|
61
|
+
"Dew Point",
|
62
|
+
:float,
|
63
|
+
convert_unit(data["dew_point"], fahrenheit),
|
64
|
+
unit: unit,
|
65
|
+
hass: { sensor: { device_class: :temperature,
|
66
|
+
icon: "mdi:water-opacity",
|
67
|
+
state_class: :measurement } })
|
68
|
+
device.property("temperature",
|
69
|
+
"Current Temperature",
|
70
|
+
:float,
|
71
|
+
convert_unit(data["temp"], fahrenheit),
|
72
|
+
unit: unit,
|
73
|
+
hass: { sensor: { device_class: :temperature,
|
74
|
+
state_class: :measurement } })
|
75
|
+
device.property("relative-humidity",
|
76
|
+
"Current Relative Humidity",
|
77
|
+
:float, data["humid"],
|
78
|
+
format: 0..100,
|
79
|
+
unit: "%",
|
80
|
+
hass: { sensor: { device_class: :humidity,
|
81
|
+
state_class: :measurement } })
|
82
|
+
device.property("co2",
|
83
|
+
"CO₂ Concentration",
|
84
|
+
:integer, data["co2"],
|
85
|
+
unit: "ppm",
|
86
|
+
hass: { sensor: { device_class: :carbon_dioxide,
|
87
|
+
state_class: :measurement } })
|
88
|
+
device.property("tvocs",
|
89
|
+
"TVOCs Concentration",
|
90
|
+
:integer,
|
91
|
+
data["voc"],
|
92
|
+
unit: "ppb",
|
93
|
+
hass: { sensor: { device_class: :volatile_organic_compounds,
|
94
|
+
state_class: :measurement } })
|
95
|
+
device.property("pm2-5",
|
96
|
+
"Fine particle concentration",
|
97
|
+
:integer,
|
98
|
+
data["pm25"],
|
99
|
+
unit: "µg/m³",
|
100
|
+
hass: { sensor: { device_class: :pm25,
|
101
|
+
state_class: :measurement } })
|
55
102
|
|
56
103
|
homie.publish
|
57
104
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: mqtt-homeassistant
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: net-http-persistent
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.23'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.23'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-performance
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.12'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop-rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +133,8 @@ files:
|
|
119
133
|
homepage: https://github.com/ccutrer/ruby-awair
|
120
134
|
licenses:
|
121
135
|
- MIT
|
122
|
-
metadata:
|
136
|
+
metadata:
|
137
|
+
rubygems_mfa_required: 'true'
|
123
138
|
post_install_message:
|
124
139
|
rdoc_options: []
|
125
140
|
require_paths:
|