I’ve been using the sensors for months now. I don’t see any battery level change anymore. At first they where decreasing %1 everyday.
Hello, which of these devices would work in the UK please? I am going for a 2nd gateway at the moment.
Now I just need mine to arrive, I bought it today
Btw, can we expect this to be integrated in HASS soon?
Yes. I will prepare a pull request soon. There is a bit work which needs to be done before.
Hello, how did you display the battery levels? Did you need to create templates for each one?
If you want the icon to be dynamic based on battery level then you do need to.
I made a decision that I couldn’t be bothered to do it
So my group with xiaomi battery group is showing static icons.
I used a template for phone battery as it changes more.
I’m using this automation that finds all the devices with the battery property as I didn’t want to add them manually and sends a notification every Tuesday at 20pm with the list of low batteries bellow 10%.
You can see the comment code that I was trying to make it fire at any time when 1 of them would run bellow 10% but could never make it work, if anyone wants to try just un-comment the code:
- alias: Notify when the battery_level is low trigger: platform: time hours: 20 minutes: 0 seconds: 0 condition: - condition: time weekday: - tue # condition: # condition: template # value_template: > # {% set num = 0 %} # {% for state in states.binary_sensor %} # {% if state.attributes.battery_level %} # {% if state.attributes.battery_level | int < 10 %} # {% set num = num + 1 | int %} # {% endif %} # {% endif %} # {% if loop.last%} # {% if num > 0 %} # True # {% else %} # False # {% endif %} # {%- endif %} # {% endfor %} action: service: notify.slack_general data_template: message: > {%- for state in states.binary_sensor -%} {%- if loop.first %}Devices with battery level low: {% endif -%} {%- if state.attributes.battery_level -%} {%- if state.attributes.battery_level | int < 10 -%} {{ state.name }}-{{ state.attributes.battery_level }}%; {%- endif -%} {%- endif -%} {%- endfor -%}
If anyone ever manages to fire the automation every time one of them runs out of battery, please share.
Hope it helps
I am almost sure they will die suddenly
thanks for sharing
All of a sudden, I am seeing the following error about once every hour or so - I’m not aware of any automations that are doing anything with the light on the gateway.
2017-08-14 18:06:06 ERROR (Thread-2) [homeassistant.components.light.xiaomi] Light RGB data error. Must be 8 characters. Received: bb00ff
Anyone else seeing this?
Thanks,
Tom
Yes. A brightness less than 5 is critical somehow.
So instead of keeping the gateway light off - I should set it to some value greater than 5?
No, no. Turn the light off is fine. The strange thing is: If you set the brightness for example to 3 and ask the gateway for the current brightness it will return a value between 1 and 4. If you set the brightness to 1 the “light RGB data error” occurs sometimes. This is just my theory.
Firstly, thanks for all the hard work gone into this integration. At this stage I almost exclusively use Xiaomi devices as they are just so good value.
Is it possible to rename the Entity ID’s?
sensor.temperature_158d00012d9624 when sent to InfluxDB is impossible to identify.
And if I replace a sensor in the future, I’d also like the new sensor data to go into the same record using the same ID.
Edit: Or should I use a sensor template to pull the state?
Late reply but anyway - The value (load power) was parsed correctly from the syntax you suggested (I also used it to create a sensor), but I still couldn’t get the trigger to fire off - so I rewrote it as below, and now the trigger fires off correctly:
trigger:
platform: template
value_template: '{{ states.switch.plug_158dXXXXXXXXXX.attributes["Load power"] > 3 }}'
Thanks for the support.
You should also include the entity_id:
part. As it optimizes the data updates (syncs it with the sensor data update times)
If anyone is interested, I can share later, an example of the way I did.
Basically it was something like this:
2 template sensors:
- 1 to show battery level + correct icon according to battery level
- 1 to determine the condition for the battery level I want to check (in my case < 10%)
1 alert to check if second template sensor is true and, if so, send a notification informing (alert periodicity can be determined - I have 1/day).
That is more or less what I currently have (without the correct icon). But I have to add many tempate sensors manually. Do you have this automated?
I’ve said on the post why it’s not as a condition, see the commented code. The problem is that the var num doesn’t persist inside the FOR loop. If you know a way, let us know.