Xiaomi Gateway Integration

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

Ah yes. A week late to the party this time.

Seems like the new firmware is more trouble than it’s worth. I’m still waiting for enhanced functionality in the square buttons.

I’ve just installed my new wall switches which also include the neutral line (called zero line in gearbest site).

I am quite surprised to see that they also show the power consumption, the daily total consumption and monthly consumption on mi app. And the current consumption seems to be true too.

It is found as switch.wall_switch_ln_158xxxxxxxx. Is there a way to get this power values readable too?

Thank you.

Please enable the debug log and provide some events of your device:

logger:
  default: warn
  logs:
    homeassistant.components.xiaomi: debug
    homeassistant.components.binary_sensor.xiaomi: debug
    homeassistant.components.sensor.xiaomi: debug
    homeassistant.components.light.xiaomi: debug
    homeassistant.components.switch.xiaomi: debug

If the events uses the same attributes like the device called “plug” you can just enable the power consumption feature for testing. Go to site-packages/homeassistant/components/switch/xiaomi.py anf flip the third parameter at device.append() from False to True:

diff --git a/homeassistant/components/switch/xiaomi.py b/homeassistant/components/switch/xiaomi.py
index 767043a8b..b21da8439 100644
--- a/homeassistant/components/switch/xiaomi.py
+++ b/homeassistant/components/switch/xiaomi.py
@@ -34,7 +34,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
             elif model == 'ctrl_ln1':
                 devices.append(XiaomiGenericSwitch(device, 'Wall Switch LN',
                                                    'channel_0',
-                                                   False, gateway))
+                                                   True, gateway))
             elif model == 'ctrl_neutral2':
                 devices.append(XiaomiGenericSwitch(device, 'Wall Switch Left',
                                                    'channel_0',
@@ -46,11 +46,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
                 devices.append(XiaomiGenericSwitch(device,
                                                    'Wall Switch LN Left',
                                                    'channel_0',
-                                                   False, gateway))
+                                                   True, gateway))
                 devices.append(XiaomiGenericSwitch(device,
                                                    'Wall Switch LN Right',
                                                    'channel_1',
-                                                   False, gateway))
+                                                   True, gateway))
             elif model == '86plug':
                 devices.append(XiaomiGenericSwitch(device, 'Wall Plug',
                                                    'status', True, gateway))
1 Like

:cold_sweat:

All variante are accepted now: CAFEC0FFEE00, CA:FE:C0:FF:EE:00, cafe0ffee00, ca:fe:c0:ff:ee:00

        res_gw_conf = {'sid': gw_conf.get(CONF_MAC)}
        if res_gw_conf['sid'] is not None:
            res_gw_conf['sid'] = res_gw_conf['sid'].replace(":", "").lower()
            if len(res_gw_conf['sid']) != 12:
                raise vol.Invalid('Invalid mac address', gw_conf.get(CONF_MAC))
        key = gw_conf.get('key')

The code retrieves the config parameter “CONF_MAC” (mac), removes the “:” and transforms to lower case. If the result doesn’t have a length of 12 chars it will be reported as invalid.

Thanks. Found out that some of the motions sensors are just stuck in the on position.
Is there any polling option like it was in rave’s code?