Xiaomi Gateway Integration

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)

1 Like

Hi @joaoasilva, shouldn’t you use the condition as a trigger to have to run automatically?

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.

yes please… I just ordered loads of button batteries just in case :d

I would definitely be interested :slight_smile:

Thanks for sharing!

I think should do the trick

  condition:
    condition: template
    value_template: >
      {% for state in states.binary_sensor if state.attributes.battery_level and state.attributes.battery_level | int < 10 %}
        {%- if loop.first -%}
          {{ true }}
        {%- endif -%}
      {% endfor %}

Let me know

1 Like

That’s a good way to approach the problem, it should work!

- alias: Notify when the battery_level is low
  trigger:
  condition:
    condition: template
    value_template: >
      {%- for state in states.binary_sensor if state.attributes.battery_level and state.attributes.battery_level | int < 10 -%}
        {%- if loop.first -%}
          {{ true }}
        {%- 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 -%}
2 Likes

Is it possible to set a loop on the gateway ringtone until the alarm is disarmed?

FYI in case nobody has noticed there is new firmware.

which one? 1.4.1.149.0143 here

Same I have… I wish I didn’t :frowning:

Have you managed to get this working? I can’t get a loop at all.

Why? Everything is supposed to be working with this firmware.

Ok plus me in to the 149 update (maybe).
Or a 0.51 update (were there any changes from 0.50?)

Running successfully since dec 2016. Yesterday had a major crash updating HA to 0.51.2. Everything went fine. Issued reboot and that’s it. As i’m running raspbian and SSH refused connections - all i could do reinstall.

Went once again with All in one installation. gited in the configs and…
Xiaomi component is working erratically. Sometimes sensors work. Sometimes they don’t. Nothing in the logs (of interest).

In config i have something like below. Any recommendations? Maybe there is way to go back to 148FW?

xiaomi:
 gateways:
  - mac:
    key: some_key

P.S. By the way since december - all my motion sensors (10pcs) have 40+ battery

P.S.S. How to input the mac? With : or without?

Having trouble figuring out under which ringtone_id my new custom recordings are going. Previously I could find the custom ringtones starting at ringtone_id 10001 and going up by 1 for each new recording. Not sure if it is the latest firmware, but they no longer seem to be going up from there.

My last successful custom ringtone ended at 10013, but I cannot reference new ringtones after that. I have tried 10014 - 10030 and can not get them to play. My previous custom recordings still are accessable at the lower ringtone_id numbers.

Anyone else seeing this issue?

Thanks

Except double and single “wireless” wall switches… which is a total pain in the …

I am on firmware 1.4.1_149.0143 - seems like new custom recordings does not work anymore - at least to be able to find the ringtone_id. Prior to this firmware, new recordings started at 10001 and each new recording went up from there. I am unable to find any new recordings.

@syssi have you seen this?

Thanks,

Tom