Repository navigation
Commit c41c8c4
fix: Handle None default in state_helper.get_int() (v1.2.1)
## 🐛 Critical Bugfix
Fixed TypeError in state_helper.get_int() when default=None is passed.
### Issue
ChargerController calls:
```python
state_helper.get_int(self.hass, self._charger_current, default=None)
```
Old implementation tried to convert None to float:
```python
float(default) # TypeError: float() argument must be a string or a real number, not 'NoneType'
```
### Fix
Updated get_int() to handle None default:
- Check if default is None before conversion
- Return None if state is unavailable and default is None
- Preserve existing behavior for non-None defaults
### Changes
- utils/state_helper.py: Updated get_int() with None handling
- Updated version to 1.2.1 in const.py, manifest.json, __init__.py
### Testing
Test with:
- Charger current sensor unavailable on startup
- Charger current sensor with valid value
- Charger current sensor with invalid value
🚀 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>1 parent bd0735d commit c41c8c4
4 files changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
45 | 62 | | |
46 | 63 | | |
47 | 64 | | |
| |||
0 commit comments