Yeah thats the version i had, after a restart of hass the other automations showed up and only 1 of my sensors. Now the next morning i see all my sensor battery levels there thanks!
Iāve got the same problem: no battery stats on PIRs, just on the illuminance part.
Sorry, I havenāt had any free time to work on home automation in a while. This is still on my todo list. I hope to resolve it soon.
You shouldnāt need to do that. The package should create separate sensor for each device that has a battery_level attribute. That sensor is the one that will be included in the group.
There is nothing special about hass.io. Just follow the instructions in the package file on github.
Can you post a screenshot of the kitchen door sensor from the states page? I need to see the attributes to identify a cause.
Can you provide more info on the sensor? How was it created? Can you post a screenshot from the states page so I can see the state and attributes?
You just need to clear the mqtt topics. Copy the topic names from the attibutes of the sensor and paste them into the MQTT Topic to Clear input_text box.
No problem, you cant always work on home automation (sadly).
I was diggin around in the code in hope to find something that might solve my problem (the value beeing 2 insteak of 2.4 and therefore the battery_template doesnt workā¦)
Does it maybe have to do something with the value needing āvalue | intā somewhere??
sensor.wohnzimmer_heizung_battery:
battery_template: '{%- if value | int < 2,4 -%} "Low" {%- else -%} "Full" {%- endif -%}'
instead of
sensor.wohnzimmer_heizung_battery:
battery_template: '{%- if value < 2,4 -%} "Low" {%- else -%} "Full" {%- endif -%}'
but maybe this is just all wrongā¦
Like I said above, if I can help you with anything here let me know
Thanks for understanding. I think I may have found the culprit. Can you try the updated version I just checked? I donāt have any sensors that use floats, so I donāt know for sure if this is the only issue. To access the float value, youāll have to leave the battery_template on the sensor like youāve got.
Edit: Try this template with the above package.
{%- if value_json.value | float < 2.4 -%}
Low
{%- else -%}
Full
{%- endif -%}
Can you try the latest version to see if that eliminates the error?
I will try right away, just two questions:
- should I remove all the created battery sensors that have the problem we are talking about before using the new version?
- sry to ask again, but which entity gets the battery_template in customize.yaml? the original one (in my case a thermostat) or the created battery sensor that got created out of the thermostat from your automations?
from customize.yaml :
sensor.kuche_heizung_battery: # this is the battery sensor battery_template: '{%- if value < 2.4 -%} "Low" {%- else -%} "Full" {%- endif -%}' climate.oeq1709806: # this is the thermostat friendly_name: KĆ¼che Heizung battery_template: '{%- if value < 2.4 -%} "Low" {%- else -%} "Full" {%- endif -%}'
You shouldnāt need to.
On the thermostat entity.
climate.oeq1709806: # this is the thermostat
friendly_name: KĆ¼che Heizung
battery_template: '{%- if value_json.value | float < 2.4 -%} Low {%- else -%} Full {%- endif -%}'
@walaj, and @pdobrien3, I just found and fixed the issue causing TypeError: object of type 'NoneType' has no len()
. Please try the latest code and let me know if you still see the errors.
@Nightcat, please update to this latest version. The fix for the error mentioned above may help your issue as well.
@NotoriousBDG
thanks for the fast update, I installed the lastest version ( 1.1.4 )
It fixed my problem of getting a 2% sensor, it now shows full!!
But I got some strange notification about an unknown device having low battery, I will dismiss that and see if it comes back againā¦
I dont have any other batteries that would trigger a notification right nowā¦
Just a few more minor things:
Would it be possible to adjust the icon from those battery sensors now, just showing a full battery and an almost empty one and not the icon with the ā?ā in it??
clicking on one of them shows me a graph with a valueā¦ I dont know where that value is coming from since the battery sensor does not have a value shown on the state screen, and it shows ā2ā again, instead of the actual 2.6V
And could you remove the ā%ā after the āFullā on those sensors??
EDIT:
Here are the MQTT messages, I dont know if you need them, might help:
homeassistant/sensor/oeq1710001_battery/config
{ "device_class" : "battery", "name" : "Arbeitszimmer Heizung Battery", "state_topic" : "homeassistant/sensor/oeq1710001_battery/state", "unit_of_measurement" : "%", "value_template" : "{%- if value_json.value | float < 2.4 -%} Low {%- else -%} Full {%- endif -%}", "unique_id" : "oeq1710001_battery", "json_attributes" : [ "entity_id", "attribute", "mqtt_config_topic", "mqtt_state_topic" ] }
homeassistant/sensor/oeq1710001_battery/state
{
āvalueā:2.6,
āentity_idā: āclimate.oeq1710001ā,
āattributeā: ābatteryā,
āmqtt_config_topicā: āhomeassistant/sensor/oeq1710001_battery/configā,
āmqtt_state_topicā: āhomeassistant/sensor/oeq1710001_battery/stateā
}
Woohoo! Glad to hear it.
Can you look at the Battery Status group to see if you see those entities there. Some screenshots of the group would help troubleshoot the issue.
Ahh. I know whatās causing that. I just need to adjust the config payload to handle string states to fix that. Iāll update the package to support that. Hopefully tomorrowā¦
I dont see any unknown entitiesā¦
but so far the notifications havent returnedā¦ so it might have been a one time only thingā¦
Could you also have a look at those two things if they are easy to change? No hurry!
Iāve got templates that return strings working now in the 1.1.5 release. Youāll need to change the attribute name in the customize section from battery_template
to battery_template_string
.
To fix the issue with the chart, try clearing the retained messages and restarting Home Assistant.
climate.oeq1709806: # this is the thermostat
friendly_name: KĆ¼che Heizung
battery_template_string: '{%- if value_json.value | float < 2.4 -%} Low {%- else -%} Full {%- endif -%}'
Did you get this resolved? Iāve just installed 1.1.5 and get the same thing. None of my customizations are working.
sensor.bottle_lights_battery:
battery_sensor_creation_disabled: true
sensor.tv_cabinet_power_battery:
battery_sensor_creation_disabled: true
sensor.office_power_battery:
battery_sensor_creation_disabled: true
sensor.front_door_deadbolt_battery:
battery_sensor_creation_disabled: true
## Adjust Xaiomi Battery Levels x 150% ##
sensor.landing_battery:
battery_template: "{{ value_json.value | int * 1.5 }}"
sensor.master_bedroom_battery:
battery_template: "{{ value_json.value | int * 1.5 }}"
sensor.office_temperature_battery:
battery_template: "{{ value_json.value | int * 1.5 }}"
sensor.stairs_cupboard_motion_battery:
battery_template: "{{ value_json.value | int * 1.5 }}"
Those customizations need to be on the parent device that has the battery attribute.
Hi @xbmcnut,
like @NotoriousBDG said all those ābattery_sensor_creation_disabled: trueā and "battery_template: ā{{ value_json.value | int * 1.5 }}ā need to be set at the original device and not the battery sensor that was created by the packageā¦
Are you adjusting the battery levels on all xiaomi devices? Cause I have a few door and window sensors and some of the Gen1 Buttons (round) and I also noticed that the battery levels never started around full (>80%) but rather low (starting around 50-60%).
Iāve done this to test:
switch.plug_158d0001dc3a20:
battery_sensor_creation_disabled: true
## Adjust Xaiomi Battery Levels x 2 ##
binary_sensor.smoke_sensor_landing:
battery_template: "{{ value_json.value | int * 2 }}"
But the office Xaiomi switch still shows a battery level and the Xaiomi Landing smoke detector still shows the same battery percentage. And yes, I intend to tweak all of my Xaiomi sensors so I can set my min level to a realistic value for all battery levels of say 70% as Iām getting flooded with notifications at the moment.
Verify that you see battery_sensor_creation_disabled: true
as an attribute on your states page for switch.plug_158d0001dc3a20
. If itās there, youāll need to clear the retained MQTT messages. Copy / paste the values of mqtt_state_topic
and mqtt_config_topic
attributes into the MQTT Topic to Clear input text box, and it should go away. It should look like this:
For binary_sensor.smoke_sensor_landing
, your screenshot shows that the battery_template
attribute hasnāt been created. Have you restarted Home Assistant after making the change? It should look like this:
Thanks for your help. Getting there. Must have missed a restart for the smoke detector!
Might need some rounding to get the value correct though?
In regards the Xaiomi office switch, I put the config topic into MQTT topic to clear and hit enter (is that all I do?) and also the state topic and then restarted HA. It now appears as unknown.
@NotoriousBDG - running it now - will update in a day or so, but no issues thus far.
many many thanks.