Skip to content

Commit 639e659

Browse files
committed
add chamber temperature chart into a separate tab
1 parent 3e7cbeb commit 639e659

File tree

8 files changed

+549
-34
lines changed

8 files changed

+549
-34
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include README.md
22
recursive-include octoprint_external_temp_reader/templates *.jinja2
3-
recursive-include octoprint_external_temp_reader/static/js *.js
3+
recursive-include octoprint_external_temp_reader/static/js *.js
4+
recursive-include octoprint_external_temp_reader/static/css *.css

README.md

Lines changed: 115 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,38 @@ This plugin reads chamber temperature from a WirelessTag API and displays it in
44

55
## Features
66

7+
### Core Functionality
78
- Fetches temperature data from WirelessTag API endpoints
8-
- Displays chamber temperature in the OctoPrint navbar (top bar)
99
- Works independently of printer connection status
1010
- Real-time temperature updates via WebSocket
11-
- Configurable polling interval
11+
- Configurable polling interval (10-300 seconds)
1212
- Support for custom XML temperature paths
1313
- Clean separation of UUID and base URL configuration
1414

15+
### Temperature Display
16+
- **Navbar Display**: Shows current chamber temperature in the top bar with thermometer icon
17+
- **Dedicated Tab**: Full-featured "Chamber Temp" tab with professional temperature monitoring interface
18+
19+
### Chamber Temperature Tab Features
20+
- **Interactive Temperature Chart**
21+
- Real-time updating graph with orange theme
22+
- Hover tooltips showing exact time and temperature
23+
- Auto-scrolling option to follow latest data
24+
- Time range controls (10 min to 24 hours)
25+
- Stores up to 24 hours of temperature history
26+
27+
- **Statistics Dashboard**
28+
- Large current temperature display
29+
- Min/Max/Average temperature calculations
30+
- Data point counter
31+
- Connection status indicator
32+
- Last update timestamp
33+
34+
- **Data Management**
35+
- Clear History button to reset all data
36+
- Export to CSV for data analysis
37+
- Automatic data trimming after 24 hours
38+
1539
## Building the Plugin
1640

1741
### Development Setup
@@ -106,8 +130,22 @@ The plugin:
106130

107131
## Where Temperature is Displayed
108132

109-
- **Navbar**: Shows "Chamber: XX.X°C" with a thermometer icon in the top bar
110-
- **Logs**: Temperature updates are logged for debugging
133+
### 1. Navbar (Top Bar)
134+
- Shows "Chamber: XX.X°C" with a thermometer icon
135+
- Always visible for quick temperature monitoring
136+
- Updates in real-time as new data arrives
137+
138+
### 2. Chamber Temp Tab
139+
- Dedicated tab in OctoPrint's main interface
140+
- Professional temperature monitoring dashboard
141+
- Interactive chart with historical data
142+
- Statistics and data management tools
143+
- No interference with printer temperature displays
144+
145+
### 3. System Logs
146+
- Temperature updates are logged for debugging
147+
- Access via Settings → Logs
148+
- Filter by "external_temp_reader" for plugin-specific logs
111149

112150
## Troubleshooting
113151

@@ -128,10 +166,18 @@ The plugin:
128166
- Verify the tag's battery level and signal strength
129167

130168
### Temperature not showing in navbar
131-
- Clear browser cache and refresh
169+
- Clear browser cache and refresh (Ctrl+F5 or Cmd+Shift+R)
132170
- Check browser console (F12) for JavaScript errors
133171
- Verify the plugin's JavaScript file loaded correctly
134172

173+
### Chamber Temp tab chart not displaying
174+
- Open browser console (F12 → Console)
175+
- Click on the "Chamber Temp" tab
176+
- Look for "External Temp Reader:" messages
177+
- Check for "Chart initialized successfully" or error messages
178+
- Clear browser cache if chart container is missing
179+
- Ensure JavaScript is enabled in your browser
180+
135181
## API Response Format
136182

137183
The plugin expects XML responses in this format from WirelessTag:
@@ -193,16 +239,41 @@ octoprint-external-temp/
193239
├── setup.py # Package setup script
194240
├── dist/ # Built distributions (not in git)
195241
└── octoprint_external_temp_reader/ # Plugin package
196-
├── __init__.py # Plugin initialization
242+
├── __init__.py # Plugin initialization & hooks
197243
├── ExternalTempReaderPlugin.py # Main plugin code
198244
├── static/ # Static assets
245+
│ ├── css/
246+
│ │ └── external_temp_reader.css # Styling for tab and navbar
199247
│ └── js/
200-
│ └── external_temp_reader.js
248+
│ └── external_temp_reader.js # Chart logic and UI updates
201249
└── templates/ # Jinja2 templates
202-
├── external_temp_reader_navbar.jinja2
203-
└── external_temp_reader_settings.jinja2
250+
├── external_temp_reader_navbar.jinja2 # Navbar temperature display
251+
├── external_temp_reader_settings.jinja2 # Settings page
252+
└── external_temp_reader_tab.jinja2 # Chamber temp tab
204253
```
205254

255+
## Usage Guide
256+
257+
### Initial Setup
258+
1. Install the plugin and restart OctoPrint
259+
2. Navigate to Settings → External Temp Reader
260+
3. Enter your WirelessTag UUID
261+
4. Save settings and refresh the page
262+
263+
### Using the Chamber Temp Tab
264+
1. Click on the "Chamber Temp" tab in OctoPrint
265+
2. Temperature data will begin populating the chart
266+
3. Use time range buttons to zoom in/out (10 min - 24 hours)
267+
4. Enable "Auto-scroll" to keep the latest data in view
268+
5. Hover over the chart to see exact temperature values
269+
6. Export data as CSV for external analysis
270+
271+
### Monitoring Temperature
272+
- **Quick View**: Check navbar for current temperature
273+
- **Detailed View**: Use Chamber Temp tab for full history
274+
- **Statistics**: Monitor Min/Max/Average on the dashboard
275+
- **Data Export**: Download CSV for spreadsheet analysis
276+
206277
## Development Tips
207278

208279
1. **Watch logs during development**:
@@ -213,21 +284,53 @@ tail -f ~/.octoprint/logs/octoprint.log | grep external_temp_reader
213284
2. **Test changes without reinstalling**:
214285
- Install in development mode (`pip install -e .`)
215286
- Changes to Python files require OctoPrint restart
216-
- Changes to JS/templates may require browser refresh
287+
- Changes to JS/CSS/templates require browser cache clear (Ctrl+F5)
217288

218289
3. **Debug JavaScript**:
219290
- Open browser console (F12)
220291
- Look for "External Temp Reader:" messages
292+
- Check for chart initialization logs
221293

222-
4. **Version bumping**:
294+
4. **Debug Chart Issues**:
295+
- Verify Flot library is loaded: `$.plot` in console
296+
- Check chart container exists: `$("#chamber-temperature-chart").length`
297+
- Look for JavaScript errors in console
298+
299+
5. **Version bumping**:
223300
- Update version in `setup.py`
224301
- Update version in `octoprint_external_temp_reader/__init__.py`
225302
- Tag the release in git
226303

304+
## Technical Details
305+
306+
### API Integration
307+
- Uses WirelessTag's public API endpoint for shared tags
308+
- Polls data at configurable intervals (default: 60 seconds)
309+
- Parses XML response with namespace handling
310+
- Extracts temperature from `temp_degC` field
311+
312+
### Frontend Architecture
313+
- KnockoutJS for data binding (OctoPrint standard)
314+
- Flot library for chart rendering
315+
- WebSocket for real-time updates
316+
- Custom CSS for consistent theming
317+
318+
### Data Storage
319+
- In-memory storage of temperature history
320+
- Maximum 2,880 data points (24 hours at 30-second intervals)
321+
- Automatic cleanup of old data
322+
- No database required
323+
227324
## License
228325

229326
Apache 2.0
230327

231328
## Author
232329

233-
330+
331+
332+
## Acknowledgments
333+
334+
- OctoPrint community for plugin development resources
335+
- WirelessTag for providing public API access
336+
- Flot charts library for visualization

octoprint_external_temp_reader/ExternalTempReaderPlugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,19 @@ def get_template_configs(self):
137137
"type": "navbar",
138138
"custom_bindings": False,
139139
"template": "external_temp_reader_navbar.jinja2"
140+
},
141+
{
142+
"type": "tab",
143+
"name": "Chamber Temp",
144+
"template": "external_temp_reader_tab.jinja2",
145+
"custom_bindings": False
140146
}
141147
]
142148

143149
def get_assets(self):
144150
return {
145-
"js": ["js/external_temp_reader.js"]
151+
"js": ["js/external_temp_reader.js"],
152+
"css": ["css/external_temp_reader.css"]
146153
}
147154

148155
def _send_temperature_update(self, temperature):
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* Chamber Temperature Monitor Styles */
2+
3+
#tab_plugin_external_temp_reader .temperature-display {
4+
background: #f9f9f9;
5+
border: 1px solid #ddd;
6+
border-radius: 4px;
7+
padding: 15px;
8+
margin-bottom: 20px;
9+
}
10+
11+
#tab_plugin_external_temp_reader .temperature-current {
12+
text-align: center;
13+
padding: 10px;
14+
background: white;
15+
border-radius: 4px;
16+
margin: 10px 0;
17+
}
18+
19+
#tab_plugin_external_temp_reader .temperature-value {
20+
color: #FF8C00;
21+
font-weight: bold;
22+
}
23+
24+
#tab_plugin_external_temp_reader .temperature-chart-container {
25+
background: white;
26+
border: 1px solid #ddd;
27+
border-radius: 4px;
28+
padding: 15px;
29+
}
30+
31+
#tab_plugin_external_temp_reader .chart-controls {
32+
text-align: center;
33+
margin-top: 15px;
34+
padding: 10px;
35+
background: #f9f9f9;
36+
border: 1px solid #ddd;
37+
border-radius: 4px;
38+
}
39+
40+
#tab_plugin_external_temp_reader .chart-controls .btn-group {
41+
display: inline-block;
42+
}
43+
44+
#tab_plugin_external_temp_reader h3 {
45+
color: #333;
46+
border-bottom: 2px solid #FF8C00;
47+
padding-bottom: 10px;
48+
margin-bottom: 20px;
49+
}
50+
51+
#tab_plugin_external_temp_reader h4 {
52+
color: #666;
53+
font-size: 14px;
54+
font-weight: bold;
55+
margin-bottom: 10px;
56+
}
57+
58+
/* Navbar temperature display */
59+
#navbar_plugin_external_temp_reader {
60+
padding: 0 10px;
61+
}
62+
63+
#navbar_plugin_external_temp_reader .navbar-text {
64+
color: #FF8C00;
65+
font-weight: bold;
66+
}
67+
68+
#navbar_plugin_external_temp_reader .fa-thermometer-half {
69+
margin-right: 5px;
70+
}
71+
72+
/* Tooltip styles */
73+
#tooltip {
74+
position: absolute;
75+
display: none;
76+
border: 1px solid #666;
77+
padding: 2px 5px;
78+
background-color: #fff;
79+
border-radius: 3px;
80+
font-size: 12px;
81+
z-index: 1000;
82+
box-shadow: 2px 2px 4px rgba(0,0,0,0.2);
83+
}

0 commit comments

Comments
 (0)