spectrum-barometer 2.1.2__tar.gz → 2.2.2__tar.gz
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.
- {spectrum_barometer-2.1.2/spectrum_barometer.egg-info → spectrum_barometer-2.2.2}/PKG-INFO +3 -3
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/README.md +2 -2
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/background.py +39 -5
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer_logger.py +1 -1
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/pyproject.toml +1 -1
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2/spectrum_barometer.egg-info}/PKG-INFO +3 -3
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/app.py +4 -4
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/routes.py +8 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/templates/dashboard.html +1 -1
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/templates/stats.html +1 -1
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/LICENSE.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/MANIFEST.in +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/__init__.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/actions.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/data.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/graphs.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/barometer/paths.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/setup.cfg +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/SOURCES.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/dependency_links.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/entry_points.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/requires.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/top_level.txt +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/__init__.py +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/static/refresh.js +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/static/stabbypeng.png +0 -0
- {spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/web/templates/base.html +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spectrum-barometer
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Monitor barometric pressure from Spectrum SAX2V1S routers
|
|
5
5
|
Author-email: BobaTeagrl <Unsorted2750@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -133,7 +133,7 @@ Append --help to any command to see extra options
|
|
|
133
133
|
|
|
134
134
|
## WEB UI
|
|
135
135
|
|
|
136
|
-
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor
|
|
136
|
+
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor, so feel free to pick whatever is easier for you!
|
|
137
137
|
|
|
138
138
|

|
|
139
139
|

|
|
@@ -169,7 +169,7 @@ If i have new ideas or find bugs/bugs get reported i may but as it sits with 2.0
|
|
|
169
169
|
|
|
170
170
|
### How hard is it to run?
|
|
171
171
|
|
|
172
|
-
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB (though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
172
|
+
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB for the cli scraping or 170 for the web UI(though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
173
173
|
|
|
174
174
|
### Can i use this on (Insert other router here)?
|
|
175
175
|
|
|
@@ -97,7 +97,7 @@ Append --help to any command to see extra options
|
|
|
97
97
|
|
|
98
98
|
## WEB UI
|
|
99
99
|
|
|
100
|
-
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor
|
|
100
|
+
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor, so feel free to pick whatever is easier for you!
|
|
101
101
|
|
|
102
102
|

|
|
103
103
|

|
|
@@ -133,7 +133,7 @@ If i have new ideas or find bugs/bugs get reported i may but as it sits with 2.0
|
|
|
133
133
|
|
|
134
134
|
### How hard is it to run?
|
|
135
135
|
|
|
136
|
-
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB (though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
136
|
+
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB for the cli scraping or 170 for the web UI(though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
137
137
|
|
|
138
138
|
### Can i use this on (Insert other router here)?
|
|
139
139
|
|
|
@@ -18,8 +18,12 @@ def get_pid_file():
|
|
|
18
18
|
"""Get path to PID file"""
|
|
19
19
|
return get_app_dir() / 'monitor.pid'
|
|
20
20
|
|
|
21
|
+
def get_owner_file():
|
|
22
|
+
"""Get path to owner file"""
|
|
23
|
+
return get_app_dir() / 'monitor.owner'
|
|
24
|
+
|
|
21
25
|
def is_monitoring():
|
|
22
|
-
"""Check if monitoring thread is running
|
|
26
|
+
"""Check if monitoring thread is running"""
|
|
23
27
|
import os
|
|
24
28
|
import psutil
|
|
25
29
|
|
|
@@ -45,10 +49,25 @@ def is_monitoring():
|
|
|
45
49
|
state_file.unlink(missing_ok=True)
|
|
46
50
|
pid_file.unlink(missing_ok=True)
|
|
47
51
|
get_interval_file().unlink(missing_ok=True)
|
|
52
|
+
get_owner_file().unlink(missing_ok=True)
|
|
48
53
|
return False
|
|
49
54
|
except:
|
|
50
55
|
return False
|
|
51
56
|
|
|
57
|
+
def is_owned_by_current_process():
|
|
58
|
+
"""Check if monitoring is owned by the current process"""
|
|
59
|
+
import os
|
|
60
|
+
|
|
61
|
+
pid_file = get_pid_file()
|
|
62
|
+
if not pid_file.exists():
|
|
63
|
+
return False
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
pid = int(pid_file.read_text().strip())
|
|
67
|
+
return pid == os.getpid()
|
|
68
|
+
except:
|
|
69
|
+
return False
|
|
70
|
+
|
|
52
71
|
def get_monitor_info():
|
|
53
72
|
"""Get monitoring status"""
|
|
54
73
|
import os
|
|
@@ -57,6 +76,7 @@ def get_monitor_info():
|
|
|
57
76
|
pid_file = get_pid_file()
|
|
58
77
|
interval = 300
|
|
59
78
|
pid = None
|
|
79
|
+
owned_by_me = False
|
|
60
80
|
|
|
61
81
|
if interval_file.exists():
|
|
62
82
|
try:
|
|
@@ -67,6 +87,7 @@ def get_monitor_info():
|
|
|
67
87
|
if pid_file.exists():
|
|
68
88
|
try:
|
|
69
89
|
pid = int(pid_file.read_text().strip())
|
|
90
|
+
owned_by_me = (pid == os.getpid())
|
|
70
91
|
except ValueError:
|
|
71
92
|
pass
|
|
72
93
|
|
|
@@ -76,6 +97,7 @@ def get_monitor_info():
|
|
|
76
97
|
'running': running,
|
|
77
98
|
'pid': pid if running else None,
|
|
78
99
|
'interval': interval if running else None,
|
|
100
|
+
'owned_by_me': owned_by_me if running else False,
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
# Thread management (only exists in the process that started it)
|
|
@@ -115,6 +137,7 @@ def start_monitoring(interval=300):
|
|
|
115
137
|
state_file = get_state_file()
|
|
116
138
|
interval_file = get_interval_file()
|
|
117
139
|
pid_file = get_pid_file()
|
|
140
|
+
owner_file = get_owner_file()
|
|
118
141
|
|
|
119
142
|
# Check if already running (cleans up stale files automatically)
|
|
120
143
|
if is_monitoring():
|
|
@@ -126,10 +149,11 @@ def start_monitoring(interval=300):
|
|
|
126
149
|
}
|
|
127
150
|
|
|
128
151
|
try:
|
|
129
|
-
|
|
152
|
+
current_pid = os.getpid()
|
|
130
153
|
state_file.write_text('running')
|
|
131
154
|
interval_file.write_text(str(interval))
|
|
132
|
-
pid_file.write_text(str(
|
|
155
|
+
pid_file.write_text(str(current_pid))
|
|
156
|
+
owner_file.write_text(str(current_pid))
|
|
133
157
|
|
|
134
158
|
# Start thread
|
|
135
159
|
_monitor_thread = threading.Thread(
|
|
@@ -143,11 +167,12 @@ def start_monitoring(interval=300):
|
|
|
143
167
|
return {
|
|
144
168
|
'success': True,
|
|
145
169
|
'message': f'Monitoring started (interval: {interval}s)',
|
|
146
|
-
'pid':
|
|
170
|
+
'pid': current_pid
|
|
147
171
|
}
|
|
148
172
|
except Exception as e:
|
|
149
173
|
state_file.unlink(missing_ok=True)
|
|
150
174
|
pid_file.unlink(missing_ok=True)
|
|
175
|
+
owner_file.unlink(missing_ok=True)
|
|
151
176
|
return {
|
|
152
177
|
'success': False,
|
|
153
178
|
'message': f'Failed to start: {e}',
|
|
@@ -155,10 +180,11 @@ def start_monitoring(interval=300):
|
|
|
155
180
|
}
|
|
156
181
|
|
|
157
182
|
def stop_monitoring():
|
|
158
|
-
"""Stop monitoring thread"""
|
|
183
|
+
"""Stop monitoring thread (only if owned by this process)"""
|
|
159
184
|
state_file = get_state_file()
|
|
160
185
|
interval_file = get_interval_file()
|
|
161
186
|
pid_file = get_pid_file()
|
|
187
|
+
owner_file = get_owner_file()
|
|
162
188
|
|
|
163
189
|
if not state_file.exists():
|
|
164
190
|
return {
|
|
@@ -166,10 +192,18 @@ def stop_monitoring():
|
|
|
166
192
|
'message': 'Monitoring is not running'
|
|
167
193
|
}
|
|
168
194
|
|
|
195
|
+
# Only stop if we own it
|
|
196
|
+
if not is_owned_by_current_process():
|
|
197
|
+
return {
|
|
198
|
+
'success': False,
|
|
199
|
+
'message': 'Monitoring is running in a different process'
|
|
200
|
+
}
|
|
201
|
+
|
|
169
202
|
# Signal thread to stop and clean up all state files
|
|
170
203
|
state_file.unlink(missing_ok=True)
|
|
171
204
|
interval_file.unlink(missing_ok=True)
|
|
172
205
|
pid_file.unlink(missing_ok=True)
|
|
206
|
+
owner_file.unlink(missing_ok=True)
|
|
173
207
|
|
|
174
208
|
return {
|
|
175
209
|
'success': True,
|
|
@@ -124,7 +124,7 @@ def cli(ctx, verbose):
|
|
|
124
124
|
@cli.command()
|
|
125
125
|
def version():
|
|
126
126
|
"""Show version information"""
|
|
127
|
-
click.echo("spectrum-barometer version 2.
|
|
127
|
+
click.echo("spectrum-barometer version 2.2.2! (that was fast :3)")
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
@cli.command()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spectrum-barometer
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: Monitor barometric pressure from Spectrum SAX2V1S routers
|
|
5
5
|
Author-email: BobaTeagrl <Unsorted2750@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -133,7 +133,7 @@ Append --help to any command to see extra options
|
|
|
133
133
|
|
|
134
134
|
## WEB UI
|
|
135
135
|
|
|
136
|
-
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor
|
|
136
|
+
You can run the scraper from the web UI or cli but ending the process stops the scrape. i thought i knew how to get around that, but i dont lol. if you do feel free to fork and if you can you will be pulled into the main codebase but for now we live with these limits. the good news is either are both quite light to run and if you run start in terminal, then open a new one and run web and you can freely play in the ui without stopping monitor, so feel free to pick whatever is easier for you!
|
|
137
137
|
|
|
138
138
|

|
|
139
139
|

|
|
@@ -169,7 +169,7 @@ If i have new ideas or find bugs/bugs get reported i may but as it sits with 2.0
|
|
|
169
169
|
|
|
170
170
|
### How hard is it to run?
|
|
171
171
|
|
|
172
|
-
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB (though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
172
|
+
When taking a reading it might take a few % of CPU and max ram use i personally have seen is 111MB for the cli scraping or 170 for the web UI(though not to say it can never get higher i cant know for sure I'm just one person) but when sitting idle its no CPU. i wanted this to be able to run on anything from a raspberry pi you already have set up running pi hole or something to someones single laptop that they are actively pushing while it runs in the background (because that's me). The web UI takes about 10-20MB of RAM loading and less just sitting there according to firefox profiler.
|
|
173
173
|
|
|
174
174
|
### Can i use this on (Insert other router here)?
|
|
175
175
|
|
|
@@ -11,15 +11,15 @@ def create_app():
|
|
|
11
11
|
from web.routes import bp
|
|
12
12
|
app.register_blueprint(bp)
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# Cleanup monitoring on shutdown ONLY if we own it
|
|
15
15
|
def cleanup():
|
|
16
|
-
from barometer.background import
|
|
17
|
-
if
|
|
16
|
+
from barometer.background import is_owned_by_current_process, stop_monitoring
|
|
17
|
+
if is_owned_by_current_process():
|
|
18
18
|
stop_monitoring()
|
|
19
19
|
|
|
20
20
|
atexit.register(cleanup)
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Handle Ctrl+C gracefully
|
|
23
23
|
def signal_handler(sig, frame):
|
|
24
24
|
cleanup()
|
|
25
25
|
sys.exit(0)
|
|
@@ -24,6 +24,7 @@ def dashboard():
|
|
|
24
24
|
theme=theme,
|
|
25
25
|
graph_ts=int(time()),
|
|
26
26
|
monitor=monitor_info,
|
|
27
|
+
can_control_monitor=monitor_info.get('owned_by_me', False) or not monitor_info.get('running', False),
|
|
27
28
|
graph_types=['line', 'smooth', 'area', 'daily', 'distribution', 'change', 'dashboard'],
|
|
28
29
|
)
|
|
29
30
|
|
|
@@ -133,6 +134,13 @@ def monitor_start():
|
|
|
133
134
|
|
|
134
135
|
@bp.route("/monitor/stop", methods=["POST"])
|
|
135
136
|
def monitor_stop():
|
|
137
|
+
from barometer.background import is_owned_by_current_process
|
|
138
|
+
|
|
139
|
+
# check if we can stop it
|
|
140
|
+
if not is_owned_by_current_process():
|
|
141
|
+
flash("Cannot stop monitoring - it's running in a different process (e.g., CLI). Stop it from where you started it", "error")
|
|
142
|
+
return redirect(url_for("main.dashboard"))
|
|
143
|
+
|
|
136
144
|
result = stop_monitoring()
|
|
137
145
|
|
|
138
146
|
if result['success']:
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
<nav>
|
|
276
276
|
<a href="{{ url_for('main.dashboard') }}" >Dashboard</a>
|
|
277
277
|
<a href="{{ url_for('main.stats') }}">Statistics</a>
|
|
278
|
-
<a class="version" href="https://github.com/BobaTeagrl/spectrum-barometer">V 2.
|
|
278
|
+
<a class="version" href="https://github.com/BobaTeagrl/spectrum-barometer">V 2.2.2 :3</a>
|
|
279
279
|
</nav>
|
|
280
280
|
|
|
281
281
|
<!-- Flash messages -->
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<nav>
|
|
70
70
|
<a href="{{ url_for('main.dashboard') }}">Dashboard</a>
|
|
71
71
|
<a href="{{ url_for('main.stats') }}">Statistics</a>
|
|
72
|
-
<a class="version" href="https://github.com/BobaTeagrl/spectrum-barometer">V 2.
|
|
72
|
+
<a class="version" href="https://github.com/BobaTeagrl/spectrum-barometer">V 2.2.2 :3</a>
|
|
73
73
|
|
|
74
74
|
</nav>
|
|
75
75
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/requires.txt
RENAMED
|
File without changes
|
{spectrum_barometer-2.1.2 → spectrum_barometer-2.2.2}/spectrum_barometer.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|