|
| 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