Browse Source

write display values every 5s to influx and ignore ddc errors.

Thomas B 5 months ago
parent
commit
6bd3442aa1
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      client/brightness.py

+ 10
- 10
client/brightness.py View File

5
 import time
5
 import time
6
 import influx
6
 import influx
7
 
7
 
8
-filter_fact = 0.9
8
+filter_fact = 0.99
9
 
9
 
10
 c_in = 0.6, -30.0, # in_a, in_b
10
 c_in = 0.6, -30.0, # in_a, in_b
11
 calibration = {
11
 calibration = {
78
 
78
 
79
             try:
79
             try:
80
                 influx.write("brightness,location=pc-back", "lux", brightness)
80
                 influx.write("brightness,location=pc-back", "lux", brightness)
81
+
82
+                for d in disps:
83
+                    name = '_'.join(d["name"].split())
84
+                    influx.write("brightness,location=" + name, "backlight", d["prev"])
81
             except:
85
             except:
82
                 pass
86
                 pass
83
 
87
 
88
             for d in disps:
92
             for d in disps:
89
                 val = lux_to_disp(d["name"], brightness)
93
                 val = lux_to_disp(d["name"], brightness)
90
                 if val != d["prev"]:
94
                 if val != d["prev"]:
91
-                    d["prev"] = val
92
-                    print("{}: Setting \"{}\" to {}".format(time.ctime(), d["name"], val))
93
-                    ddc.ddc_set(d["_id"], val)
94
-
95
                     try:
95
                     try:
96
-                        name = '_'.join(d["name"].split())
97
-                        influx.write("brightness,location=" + name, "backlight", val)
98
-                    except:
99
-                        pass
100
-
96
+                        print("{}: Setting \"{}\" to {}".format(time.ctime(), d["name"], val))
97
+                        ddc.ddc_set(d["_id"], val)
98
+                        d["prev"] = val
99
+                    except Exception as e:
100
+                        print(e)

Loading…
Cancel
Save