Skip to content

Commit 3e7cbeb

Browse files
committed
Initial working implementation with the temperature display in the top bar
0 parents  commit 3e7cbeb

File tree

10 files changed

+677
-0
lines changed

10 files changed

+677
-0
lines changed

.gitignore

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
*.py,cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
db.sqlite3-journal
61+
62+
# Flask stuff:
63+
instance/
64+
.webassets-cache
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
target/
74+
75+
# Jupyter Notebook
76+
.ipynb_checkpoints
77+
78+
# IPython
79+
profile_default/
80+
ipython_config.py
81+
82+
# pyenv
83+
.python-version
84+
85+
# pipenv
86+
Pipfile.lock
87+
88+
# PEP 582
89+
__pypackages__/
90+
91+
# Celery stuff
92+
celerybeat-schedule
93+
celerybeat.pid
94+
95+
# SageMath parsed files
96+
*.sage.py
97+
98+
# Environments
99+
.env
100+
.venv
101+
env/
102+
venv/
103+
ENV/
104+
env.bak/
105+
venv.bak/
106+
107+
# Spyder project settings
108+
.spyderproject
109+
.spyproject
110+
111+
# Rope project settings
112+
.ropeproject
113+
114+
# mkdocs documentation
115+
/site
116+
117+
# mypy
118+
.mypy_cache/
119+
.dmypy.json
120+
dmypy.json
121+
122+
# Pyre type checker
123+
.pyre/
124+
125+
# IDE
126+
.idea/
127+
.vscode/
128+
*.swp
129+
*.swo
130+
*~
131+
132+
# macOS
133+
.DS_Store
134+
135+
# OctoPrint specific
136+
*.gcode

MANIFEST.in

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

README.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# OctoPrint External Temperature Reader Plugin
2+
3+
This plugin reads chamber temperature from a WirelessTag API and displays it in OctoPrint's interface.
4+
5+
## Features
6+
7+
- Fetches temperature data from WirelessTag API endpoints
8+
- Displays chamber temperature in the OctoPrint navbar (top bar)
9+
- Works independently of printer connection status
10+
- Real-time temperature updates via WebSocket
11+
- Configurable polling interval
12+
- Support for custom XML temperature paths
13+
- Clean separation of UUID and base URL configuration
14+
15+
## Building the Plugin
16+
17+
### Development Setup
18+
19+
1. **Clone the repository**:
20+
```bash
21+
git clone https://github.com/mike-enker/octoprint-external-temp.git
22+
cd octoprint-external-temp
23+
```
24+
25+
2. **Create a virtual environment** (recommended):
26+
```bash
27+
python3 -m venv .venv
28+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
29+
```
30+
31+
3. **Install development dependencies**:
32+
```bash
33+
pip install -r requirements.txt
34+
```
35+
36+
4. **Install plugin in development mode**:
37+
```bash
38+
pip install -e .
39+
```
40+
41+
### Building for Distribution
42+
43+
1. **Build the distribution package**:
44+
```bash
45+
python setup.py sdist bdist_wheel
46+
```
47+
48+
This creates two files in the `dist/` directory:
49+
- `OctoPrint-ExternalTempReader-1.0.0.tar.gz` - Source distribution
50+
- `OctoPrint_ExternalTempReader-1.0.0-py2.py3-none-any.whl` - Wheel distribution
51+
52+
2. **Clean build artifacts** (optional):
53+
```bash
54+
rm -rf build/ dist/ *.egg-info/
55+
```
56+
57+
## Installation
58+
59+
### Method 1: Install from Distribution Package
60+
61+
```bash
62+
pip install dist/OctoPrint-ExternalTempReader-1.0.0.tar.gz
63+
```
64+
65+
### Method 2: Install via OctoPrint Plugin Manager
66+
67+
1. Open OctoPrint web interface
68+
2. Go to Settings → Plugin Manager
69+
3. Click "Get More..." → "...from URL"
70+
4. Enter: `https://github.com/mike-enker/octoprint-external-temp/archive/main.zip`
71+
5. Click Install
72+
73+
### Method 3: Upload Distribution File
74+
75+
1. Build the plugin as described above
76+
2. In OctoPrint, go to Settings → Plugin Manager
77+
3. Click "Get More..." → "...from an uploaded file"
78+
4. Select the `.tar.gz` or `.whl` file from `dist/`
79+
5. Click Install
80+
81+
## Configuration
82+
83+
1. Navigate to OctoPrint Settings → External Temp Reader
84+
2. Configure the following settings:
85+
- **WirelessTag UUID**: Your sensor's UUID (e.g., `5136d0e3-e226-43b2-b9a1-f843a0220f63`)
86+
- **API Base URL**: Usually the default is fine (`https://my.wirelesstag.net/ethLogShared.asmx/GetLatestTemperatureRawDataByUUID`)
87+
- **Polling Interval**: How often to fetch temperature (10-300 seconds, default 60)
88+
- **XML Temperature Path**: Leave default for WirelessTag API
89+
90+
### Getting Your WirelessTag UUID
91+
92+
1. Log into your WirelessTag account at https://my.wirelesstag.net
93+
2. Navigate to your tag settings
94+
3. Enable "Share" for the tag you want to monitor
95+
4. Copy the UUID from the sharing URL
96+
5. Enter just the UUID in the plugin settings
97+
98+
## How It Works
99+
100+
The plugin:
101+
1. Polls the WirelessTag API at the configured interval
102+
2. Parses the XML response to extract temperature in Celsius
103+
3. Sends temperature updates to the frontend via WebSocket
104+
4. Displays the chamber temperature in the navbar (top bar)
105+
5. Works independently of printer connection status
106+
107+
## Where Temperature is Displayed
108+
109+
- **Navbar**: Shows "Chamber: XX.X°C" with a thermometer icon in the top bar
110+
- **Logs**: Temperature updates are logged for debugging
111+
112+
## Troubleshooting
113+
114+
### Plugin doesn't appear in Plugin Manager
115+
- Ensure the plugin files are properly installed
116+
- Check OctoPrint logs for loading errors
117+
- Verify Python compatibility (requires Python 2.7+ or 3.x)
118+
119+
### No temperature readings
120+
- Verify your UUID is entered correctly
121+
- Check that the tag's sharing is enabled in WirelessTag
122+
- Look in OctoPrint logs (Settings → Logs) for error messages
123+
- Test the API URL directly in a browser to ensure it returns XML data
124+
125+
### Temperature shows as 0 or incorrect
126+
- Ensure your WirelessTag is reporting data
127+
- Check the XML path configuration if using a custom format
128+
- Verify the tag's battery level and signal strength
129+
130+
### Temperature not showing in navbar
131+
- Clear browser cache and refresh
132+
- Check browser console (F12) for JavaScript errors
133+
- Verify the plugin's JavaScript file loaded correctly
134+
135+
## API Response Format
136+
137+
The plugin expects XML responses in this format from WirelessTag:
138+
```xml
139+
<?xml version="1.0" encoding="utf-8"?>
140+
<TemperatureDataPoint xmlns="http://mytaglist.com/ethLogShared">
141+
<time>2025-09-06T15:38:19-04:00</time>
142+
<temp_degC>22.487756347656251</temp_degC>
143+
<cap>76.46612548828125</cap>
144+
<lux>0</lux>
145+
<battery_volts>3.1466694920952931</battery_volts>
146+
</TemperatureDataPoint>
147+
```
148+
149+
## Deployment
150+
151+
### Publishing to PyPI (Optional)
152+
153+
1. **Build the distribution**:
154+
```bash
155+
python setup.py sdist bdist_wheel
156+
```
157+
158+
2. **Upload to PyPI**:
159+
```bash
160+
twine upload dist/*
161+
```
162+
163+
### Publishing to OctoPrint Plugin Repository
164+
165+
1. Fork the [OctoPrint Plugin Repository](https://github.com/OctoPrint/plugins.octoprint.org)
166+
2. Create a new file `_plugins/external_temp_reader.md` with plugin details
167+
3. Submit a pull request
168+
169+
### Creating a GitHub Release
170+
171+
1. **Tag the release**:
172+
```bash
173+
git tag -a v1.0.0 -m "Release version 1.0.0"
174+
git push origin v1.0.0
175+
```
176+
177+
2. **Create release on GitHub**:
178+
- Go to your repository's Releases page
179+
- Click "Create a new release"
180+
- Select the tag you created
181+
- Upload the `.tar.gz` and `.whl` files from `dist/`
182+
- Add release notes
183+
184+
## Project Structure
185+
186+
```
187+
octoprint-external-temp/
188+
├── .gitignore # Git ignore file
189+
├── .venv/ # Virtual environment (not in git)
190+
├── MANIFEST.in # Package manifest
191+
├── README.md # This file
192+
├── requirements.txt # Development dependencies
193+
├── setup.py # Package setup script
194+
├── dist/ # Built distributions (not in git)
195+
└── octoprint_external_temp_reader/ # Plugin package
196+
├── __init__.py # Plugin initialization
197+
├── ExternalTempReaderPlugin.py # Main plugin code
198+
├── static/ # Static assets
199+
│ └── js/
200+
│ └── external_temp_reader.js
201+
└── templates/ # Jinja2 templates
202+
├── external_temp_reader_navbar.jinja2
203+
└── external_temp_reader_settings.jinja2
204+
```
205+
206+
## Development Tips
207+
208+
1. **Watch logs during development**:
209+
```bash
210+
tail -f ~/.octoprint/logs/octoprint.log | grep external_temp_reader
211+
```
212+
213+
2. **Test changes without reinstalling**:
214+
- Install in development mode (`pip install -e .`)
215+
- Changes to Python files require OctoPrint restart
216+
- Changes to JS/templates may require browser refresh
217+
218+
3. **Debug JavaScript**:
219+
- Open browser console (F12)
220+
- Look for "External Temp Reader:" messages
221+
222+
4. **Version bumping**:
223+
- Update version in `setup.py`
224+
- Update version in `octoprint_external_temp_reader/__init__.py`
225+
- Tag the release in git
226+
227+
## License
228+
229+
Apache 2.0
230+
231+
## Author
232+
233+

0 commit comments

Comments
 (0)