Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prometheus-dyson
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
prometheus-dyson
Commits
28c2ed9d
Commit
28c2ed9d
authored
3 years ago
by
Sean Rees
Browse files
Options
Downloads
Patches
Plain Diff
Add support for Pure Cool Formaldehyde fans and bump to 0.3.1
parent
65102bdb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
BUILD
+1
-1
1 addition, 1 deletion
BUILD
README.md
+1
-0
1 addition, 0 deletions
README.md
metrics.py
+5
-0
5 additions, 0 deletions
metrics.py
metrics_test.py
+23
-0
23 additions, 0 deletions
metrics_test.py
with
30 additions
and
1 deletion
BUILD
+
1
−
1
View file @
28c2ed9d
...
...
@@ -112,5 +112,5 @@ pkg_deb(
package
=
"
prometheus-dyson
"
,
postrm
=
"
debian/postrm
"
,
prerm
=
"
debian/prerm
"
,
version
=
"
0.3.
0
"
,
version
=
"
0.3.
1
"
,
)
This diff is collapsed.
Click to expand it.
README.md
+
1
−
0
View file @
28c2ed9d
...
...
@@ -54,6 +54,7 @@ dyson_volatile_organic_compounds_units | gauge | all | volatile organic compound
dyson_dust_units | gauge | V1 fans only | dust level (range 0-10)
dyson_pm25_units | gauge | V2 fans only | PM2.5 units (µg/m^3 ?)
dyson_pm10_units | gauge | V2 fans only | PM10 units (µg/m^3 ?)
dyson_formaldehyde_units | gauge | Formaldehyde units only | Formaldehyde/H-CHO units
dyson_nitrogen_oxide_units | gauge | V2 fans only | Nitrogen Oxide (NOx) levels (range 0-10)
...
...
This diff is collapsed.
Click to expand it.
metrics.py
+
5
−
0
View file @
28c2ed9d
...
...
@@ -122,6 +122,8 @@ class Metrics:
'
dyson_pm10_units
'
,
'
Level of PM10 particulate matter (V2 units only)
'
)
self
.
nox
=
make_gauge
(
'
dyson_nitrogen_oxide_units
'
,
'
Level of nitrogen oxides (NOx, V2 units only)
'
)
self
.
formaldehyde
=
make_gauge
(
'
dyson_formaldehyde_units
'
,
'
Level of formaldehyde/H-CHO (Formaldehyde unit only)
'
)
# Operational State (v1 & v2 common)
# Not included: tilt (known values: "OK", others?), standby_monitoring.
...
...
@@ -235,6 +237,9 @@ class Metrics:
update_env_gauge
(
self
.
voc
,
name
,
device
.
serial
,
voc
)
update_env_gauge
(
self
.
nox
,
name
,
device
.
serial
,
nox
)
if
isinstance
(
device
,
libdyson
.
DysonPureCoolFormaldehyde
):
update_env_gauge
(
self
.
formaldehyde
,
name
,
device
.
serial
,
device
.
formaldehyde
)
def
update_common_environmental
(
self
,
name
:
str
,
device
)
->
None
:
update_gauge
(
self
.
last_update_environmental
,
name
,
device
.
serial
,
timestamp
())
...
...
This diff is collapsed.
Click to expand it.
metrics_test.py
+
23
−
0
View file @
28c2ed9d
...
...
@@ -84,6 +84,29 @@ class TestMetrics(unittest.TestCase):
got
=
self
.
registry
.
get_sample_value
(
metric
,
labels
)
self
.
assertEqual
(
got
,
want
,
f
'
metric
{
metric
}
'
)
def
test_update_formaldehyde_environmental
(
self
):
device
=
libdyson
.
DysonPureCoolFormaldehyde
(
SERIAL
,
CREDENTIALS
,
libdyson
.
DEVICE_TYPE_PURE_COOL_FORMALDEHYDE
)
payload
=
{
'
msg
'
:
'
ENVIRONMENTAL-CURRENT-SENSOR-DATA
'
,
'
time
'
:
'
2021-03-17T15:09:23.000Z
'
,
'
data
'
:
{
'
tact
'
:
'
2956
'
,
'
hact
'
:
'
0047
'
,
'
pm10
'
:
'
3
'
,
'
pm25
'
:
'
INIT
'
,
'
noxl
'
:
30
,
'
va10
'
:
'
INIT
'
,
'
hcho
'
:
'
0002
'
,
'
hchr
'
:
'
0003
'
,
'
sltm
'
:
'
OFF
'
}
}
device
.
_handle_message
(
payload
)
labels
=
{
'
name
'
:
NAME
,
'
serial
'
:
SERIAL
}
self
.
metrics
.
update
(
NAME
,
device
,
is_state
=
False
,
is_environmental
=
True
)
cases
=
{
'
dyson_formaldehyde_units
'
:
2
,
}
for
metric
,
want
in
cases
.
items
():
got
=
self
.
registry
.
get_sample_value
(
metric
,
labels
)
self
.
assertEqual
(
got
,
want
,
f
'
metric
{
metric
}
'
)
def
test_update_v1_state
(
self
):
device
=
libdyson
.
DysonPureHotCoolLink
(
SERIAL
,
CREDENTIALS
,
libdyson
.
DEVICE_TYPE_PURE_HOT_COOL_LINK
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment