6 months after I raised a bug about the iphone companion app not recording battery, and filling the HA log with errors - nothing’s happened. How do we actually these things addressed because I suspect it’s a very small fix.
opened 08:31PM - 03 Oct 23 UTC
integration: mobile_app
### The problem
Log files filling up with errors where the mobile battery state… seems to be looking for an int, but is receiving a string. My log files are full of them making it hard to look into other issues.
### What version of Home Assistant Core has the issue?
core-2023.9.3
### What was the last working version of Home Assistant Core?
unknown
### What type of installation are you running?
Home Assistant Container
### Integration causing the issue
_No response_
### Link to integration documentation on our website
_No response_
### Diagnostics information
_No response_
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
```txt
2023-10-03 20:07:48.865 ERROR (MainThread) [homeassistant.util.logging] Exception in _handle_update when dispatching 'mobile_app_sensor_update-1aa557e5c50d32782fb5e2299cb699999f0daaaec1facc8097a2ab8880405c22_battery_state': ({'attributes': {'Low Power Mode': False}, 'icon': 'mdi:battery-50', 'state': 'Not Charging', 'type': 'sensor', 'unique_id': 'battery_state', 'webhook_id': '1aa557e5c50d32782fb5e2299cb699999f0daaaec1facc8097a2ab8880405c22'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 586, in state
numerical_value = int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Not Charging'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 589, in state
numerical_value = float(value)
^^^^^^^^^^^^
ValueError: could not convert string to float: 'Not Charging'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mobile_app/entity.py", line 106, in _handle_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
raise ValueError(
ValueError: Sensor sensor.hamble_iphone_battery_state has device class 'battery', state class 'None' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Not Charging' (<class 'str'>)
```
### Additional information
_No response_
MaxK
(Mark)
April 12, 2024, 8:36pm
2
Just curious, what troubleshooting steps did you try already?
2 Likes
jeffcrum
(Jeff Crum)
April 12, 2024, 11:24pm
3
What time frame are you expecting from opensource (free) software?
And, why?
You could certainly submit a PR for this ‘very small fix’. Feel free to bring your expertise to the community.
Someone in the GitHub thread said they had a fix - did you try it?
1 Like