First with the bad news. With the upcoming 0.69 release of Home Assistant, there is a breaking change where this package will cause problems with MQTT component in Home Assistant.
Now for the good news. To prevent an issue with the upgrade, you must update the package to the latest version then wait long enough for every battery device to report it’s latest battery level before you upgrade to Home Assistant 0.69**.
For some even better news, with 0.69, it’s finally possible to dynamically set the icon based on battery levels. The latest version of the package enables that feature so once you upgrade, you’ll have dynamic battery icons.
Lastly, for anyone that’s too impatient to wait for the package to fix the issue before upgrading. You accelerate things by installing the new package, restarting Home Assistant, uninstalling and reinstalling the MQTT addon (to purge retained data), then proceed to upgrade Home Assistant. Your battery sensors will automatically get recreated as they report in.
Thank you very much. Mine keep reporting the old memories of battery.
example.
Yesterday my battery is 44% report.
Today my actual battery is 90% but still keep reporting that it is 44%
Can you paste a screenshot of the /dev-state page showing the attributes of the sensor that’s having issues as well as the battery sensor that’s related to it?
I am trying to import your package and I get this error checking configuration:
Invalid config for [automation]: required key not provided @ data['action']. Got None
required key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
I am pretty sure that I have copied correctly the yaml file from your repository.
Thanks for the kind words. I’m glad that it’s helpful.
I don’t know of a way to make the group membership dynamic, but there is a way to make creating the group easier. Navigate to the /dev-template page then paste the template code below into the editor section. The right hand side will have the yaml needed to create a group that contains all of your battery sensors, which you can just copy/paste into your config.
battery_status:
name: Battery Status
icon: mdi:battery-charging
entities:
{%- for item in states.sensor if (
"battery" in item.name | lower
and not "voltage" in item.name | lower
and not "runtime" in item.name | lower
and not "setpoint" in item.name | lower
and not "charge" in item.name | lower
) %}
- {{ item.entity_id }}
{%- endfor -%}
That’s all you should need to do. Did you clear both the config and state topics? They should be homeassistant/sensor/illumination_158b0001e67306_battery/state and homeassistant/sensor/illumination_158b0001e67306_battery/config for your sensor with entity_id of sensor.illumination_158b0001e67306. You’ll have to restart Home Assistant after clearing those topics to complete the removal.
I did indeed. I actually deleted the entire mosquito database as there was a lot of old historical junk I there from testing etc but the sensors still created. I’ll try it again maybe I missed something.
Well, that definitely would remove them . Can you show me a screenshot of sensor.illumination_158b0001e67306 and the battery sensor from the /dev/state page?
After updating to 0.69.0 I received a ton of MQTT errors relating to “device_class” and all the battery entities are now missing.
Error below:
2018-05-11 19:04:49 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform mqtt
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/sensor/mqtt.py", line 57, in async_setup_platform
config = PLATFORM_SCHEMA(discovery_info)
File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/voluptuous/schema_builder.py", line 267, in __call__
return self._compiled([], data)
File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/voluptuous/schema_builder.py", line 587, in validate_dict
return base_validate(path, iteritems(data), out)
File "/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/voluptuous/schema_builder.py", line 425, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: value is not allowed for dictionary value @ data['device_class']