That looks to happen when there are no battery sensors detected. I’ll have to add a condition to the automation to prevent that.
Can you post a screenshot of the states page for the sensors that aren’t working? I need to see the attributes and entity_id for them to troubleshoot the issue.
Device_class would only need to be set on battery sensors that you create manually. Ones that are created automatically will already have it set.
Interesting, there is nothing there that would make me thing it wouldn’t work. Can you try a few things to help isolate where the issue is. First, watch MQTT messages using mosquitto_sub -h MQTT_IP -u MQTT_USERNAME -P 'MQTT_PASSWORD' -v -t 'homeassistant/sensor/#' then force a state change on the multisensor. Let me know if you see any MQTT messages show up. If you don’t see any messages, can you also check to see the last time the “Create Battery Sensor from Attributes” automation was triggered?
That’s great to hear. Yes, try forcing a state change on those sensors will make them show up faster. You can also just wait for them to eventually send an update since most battery sensors will eventually send an update, but it can take many hours.
I’m sure you are/have been experiencing ‘scope creep’ on your project but I will be selfish anyway and after thanking you for all your work… I request help debug a little issue I have.
When I include your code according to all instructions, running thru the configuration validation routine I receive the error:
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/
The error only shows up when I uncomment the “packages: !include_dir_named packages” line. Checking the automations.yaml file shows a blank text file.
( battery_alert.yaml v1.1.1, has.io supervisor version 125, HasOS 1.9, HA 0.75.3, Pi3b+)
The last two lines of the home-assistant.log file shows:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 386, in _get_data
data = json.loads(response.text.split("'", 1)[1])
IndexError: list index out of range
I created a dummy automation in the automation editor.
It works now.
I did receive an error saying mqtt had a problem but that was resolved by putting in the
broker: <local.ip.address> line in configuration.yaml
Weird about needing an automation prewritten before your wonderful script.
I’m new with this software. I guess my old habits of coding the foundation before you framed the house isn’t normal protocol anymore…
Thank you very much for your attention to this matter. You made me smile.
I’ve noticed one issue. The groups named group.battery_alert and group.battery_view appeared ok after restart. However, the groups disappear when reloading groups from the configuration screen.
As I’m quite new in the HASS area, I can’t help solve it yet.
As an alternative, you could use the new lovelace UI, allows you to modify your ‘groups’ while HA is running. I find Lovelace far better to the old style groups UI bit they started with.