Skip to content

Commit d9237d1

Browse files
committed
Release v1.0.1
Bug Fixes: - Reduced console logging for cleaner output
1 parent 6f97571 commit d9237d1

File tree

7 files changed

+211
-5
lines changed

7 files changed

+211
-5
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,58 @@ Each HA user can have their own Ultra Card Pro Cloud integration configured:
168168

169169
Each user will see their own PRO features based on their subscription.
170170

171+
## 👨‍💻 Development
172+
173+
### Version Management
174+
175+
This integration uses a **single source of truth** for version numbers:
176+
177+
**To change the version:**
178+
179+
1. Edit `version.py` (in the **root folder**):
180+
181+
```python
182+
__version__ = "1.0.1" # Change this
183+
```
184+
185+
2. Sync to manifest (**REQUIRED before deploying**):
186+
187+
```bash
188+
npm run version:update
189+
```
190+
191+
3. Deploy:
192+
```bash
193+
npm run deploy
194+
```
195+
196+
You have **full manual control** - the deploy script does NOT auto-update the version.
197+
198+
See [VERSION_GUIDE.md](VERSION_GUIDE.md) for detailed documentation.
199+
200+
### Local Development
201+
202+
```bash
203+
# Install dependencies (none required, pure Python + Node deploy script)
204+
npm install
205+
206+
# Update version across all files
207+
npm run version:update
208+
209+
# Deploy to local Home Assistant
210+
npm run deploy
211+
```
212+
213+
## 📝 Changelog
214+
215+
### Version 1.0.1
216+
217+
- **Reduced console logging** - Removed excess debug logging for cleaner output
218+
219+
### Version 1.0.0
220+
221+
- Initial release with cloud authentication and auto-refresh
222+
171223
## 🤝 Support
172224

173225
- **Issues:** [GitHub Issues](https://github.com/WJDDesigns/ultra-card-pro-cloud/issues)

VERSION_GUIDE.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Version Management Guide
2+
3+
## Single Source of Truth
4+
5+
The version for Ultra Card Pro Cloud is managed in **one place only**:
6+
7+
```
8+
custom_components/ultra_card_pro_cloud/version.py
9+
```
10+
11+
## How to Change the Version
12+
13+
1. **Edit `version.py`**:
14+
15+
```python
16+
__version__ = "1.0.1" # Change this number
17+
```
18+
19+
2. **Sync to manifest.json** (choose one method):
20+
21+
**Option A - Using npm:**
22+
23+
```bash
24+
npm run version:update
25+
```
26+
27+
**Option B - Direct command:**
28+
29+
```bash
30+
node update-version.js
31+
```
32+
33+
3. **Deploy** (automatic version sync included):
34+
35+
```bash
36+
npm run deploy
37+
```
38+
39+
The deploy script automatically runs `update-version.js` before deploying.
40+
41+
## Files Updated
42+
43+
When you run `update-version.js`, it will:
44+
45+
- ✅ Read version from `version.py`
46+
- ✅ Update `manifest.json` with the new version
47+
- ✅ Show you what changed
48+
49+
## Where Version is Used
50+
51+
The version appears in:
52+
53+
- `manifest.json` - Home Assistant integration metadata
54+
- `__init__.py` - Logs during integration setup
55+
- Home Assistant logs when the integration starts
56+
57+
## Example Workflow
58+
59+
```bash
60+
# 1. Edit version.py in the root folder
61+
# Change: __version__ = "1.0.1"
62+
63+
# 2. Sync the version to manifest.json (REQUIRED)
64+
npm run version:update
65+
66+
# 3. Deploy to Home Assistant
67+
npm run deploy
68+
```
69+
70+
## Important Notes
71+
72+
- 🎯 **Only edit `version.py` (root folder)** - don't manually edit `manifest.json`
73+
-**Manual control** - You must run `npm run version:update` before deploying
74+
- 📝 Version format: Use semantic versioning (e.g., `1.0.0`, `1.1.0`, `2.0.0-beta1`)
75+
- 📁 The `version.py` file is in the **root folder** for easy access (just like Ultra Card's `src/version.ts`)

custom_components/ultra_card_pro_cloud/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
)
1717
from .coordinator import UltraCardProCloudCoordinator
1818

19+
# Read version from root version.py file
20+
import os
21+
__version__ = "1.0.0"
22+
try:
23+
version_file = os.path.join(os.path.dirname(__file__), "..", "..", "version.py")
24+
if os.path.exists(version_file):
25+
with open(version_file) as f:
26+
for line in f:
27+
if line.startswith("__version__"):
28+
__version__ = line.split("=")[1].strip().strip('"').strip("'")
29+
break
30+
except Exception:
31+
pass # Fall back to default version
32+
1933
_LOGGER = logging.getLogger(__name__)
2034

2135
PLATFORMS: list[Platform] = [Platform.SENSOR] # Sensor platform for authentication status
@@ -24,13 +38,13 @@
2438
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
2539
"""Set up the Ultra Card Pro Cloud component."""
2640
# For config flow integrations, this is called but domain setup happens in async_setup_entry
27-
_LOGGER.info("Ultra Card Pro Cloud component setup called")
41+
_LOGGER.info("Ultra Card Pro Cloud v%s component setup called", __version__)
2842
return True
2943

3044

3145
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3246
"""Set up Ultra Card Pro Cloud from a config entry."""
33-
_LOGGER.info("Starting Ultra Card Pro Cloud integration setup for entry: %s", entry.entry_id)
47+
_LOGGER.info("Starting Ultra Card Pro Cloud v%s integration setup for entry: %s", __version__, entry.entry_id)
3448

3549
# Initialize domain in hass.data - this is critical for frontend access
3650
hass.data.setdefault(DOMAIN, {})

custom_components/ultra_card_pro_cloud/manifest.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"domain": "ultra_card_pro_cloud",
33
"name": "Ultra Card Pro Cloud",
4-
"codeowners": ["@WJDDesigns"],
4+
"codeowners": [
5+
"@WJDDesigns"
6+
],
57
"config_flow": true,
68
"dependencies": [],
79
"documentation": "https://github.com/WJDDesigns/ultra-card-pro-cloud",
810
"integration_type": "service",
911
"iot_class": "cloud_polling",
1012
"issue_tracker": "https://github.com/WJDDesigns/ultra-card-pro-cloud/issues",
1113
"requirements": [],
12-
"version": "1.0.0"
14+
"version": "1.0.1"
1315
}
14-

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Home Assistant integration for Ultra Card Pro Cloud authentication",
55
"main": "deploy.js",
66
"scripts": {
7+
"version:update": "node update-version.js",
78
"deploy": "node deploy.js"
89
},
910
"keywords": [

update-version.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Update version across all integration files
5+
* This reads from version.py and updates manifest.json
6+
*
7+
* Usage: node update-version.js
8+
*/
9+
10+
const fs = require("fs");
11+
const path = require("path");
12+
13+
const VERSION_FILE = path.join(__dirname, "version.py");
14+
const MANIFEST_FILE = path.join(
15+
__dirname,
16+
"custom_components/ultra_card_pro_cloud/manifest.json"
17+
);
18+
19+
console.log("🔄 Updating Ultra Card Pro Cloud version...\n");
20+
21+
// Read version from version.py
22+
let version = "";
23+
try {
24+
const versionContent = fs.readFileSync(VERSION_FILE, "utf8");
25+
const match = versionContent.match(/__version__\s*=\s*["'](.+?)["']/);
26+
27+
if (!match) {
28+
console.error("❌ Could not find __version__ in version.py");
29+
process.exit(1);
30+
}
31+
32+
version = match[1];
33+
console.log(`✅ Found version in version.py: ${version}`);
34+
} catch (error) {
35+
console.error(`❌ Error reading version.py: ${error.message}`);
36+
process.exit(1);
37+
}
38+
39+
// Update manifest.json
40+
try {
41+
const manifestContent = fs.readFileSync(MANIFEST_FILE, "utf8");
42+
const manifest = JSON.parse(manifestContent);
43+
44+
const oldVersion = manifest.version;
45+
manifest.version = version;
46+
47+
fs.writeFileSync(MANIFEST_FILE, JSON.stringify(manifest, null, 2) + "\n");
48+
console.log(`✅ Updated manifest.json: ${oldVersion}${version}`);
49+
} catch (error) {
50+
console.error(`❌ Error updating manifest.json: ${error.message}`);
51+
process.exit(1);
52+
}
53+
54+
console.log("\n🎉 Version update complete!\n");
55+
console.log("📝 Changed files:");
56+
console.log(" - custom_components/ultra_card_pro_cloud/manifest.json\n");

version.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Ultra Card Pro Cloud Integration Version
3+
This is the single source of truth for version information.
4+
"""
5+
6+
__version__ = "1.0.1"
7+

0 commit comments

Comments
 (0)