Xiaomi Gateway Integration

cool, but is it better then effect: random?

Thanks. I tried the following colors: red, green, blue, goldenrod, chocolate and yellow. It only worked with red, green and blue - i.e. the three standard RGB-colors. All the other colors end up as white. Has anyone tried to apply Flux Light Adjustment to the Gateway Light? If working this could result in an “eye-friendly” night light.

You use service: homeassistant.turn_on. Maybe this is a reason why you have problems with color. Try service: light.turn_on.

Effect random isn’t working form me.

I just want to give some feedback. After the new 1.4.1_146.0141 the door/window sensors are no longer stuck in the “open” state after a power cut. PIR sensors, however, still show motion after a power cut.

There were some questions about using cube to adjust brightness but there was never a complete code posted, after some trial and error i got mine working with my yeelights so here it is:

- id: rotate_cube_brightness
  alias: Set brightness by rotating cube
  trigger:
    platform: event
    event_type: cube_action
    event_data:
      entity_id: binary_sensor.cube_158d00011xxxxx
      action_type: rotate
  action:
    service: light.turn_on
    data_template:
      entity_id: group.kitchen_lights
      brightness: >
                    {% set state = states.light.yeelight_white_1.attributes.brightness|int + ((trigger.event.data.action_value|float)*1.25)|int -%}
                    {%-  if state > 255 -%}
                       {%- set state  = 255 -%}
                    {%-  elif state < 0 -%}
                       {%- set state  = 0 -%}
                    {%- endif %}
                    {{ state }}

i put in the 1.25 multiplier so I don’t have to rotate the cube a lot to get from 0 to 100 brightness since it increased the brightness by the amount it rotates in the first iteration of the code and i found it to be a bit cumbersome so i sped it up by 25%

3 Likes

Thanks. But no, I already tried that. :slight_smile:

Yes, I’m using flux with my yeelights, it works well.

Also with the Gateway’s light? With the Yeelights I use it as well - works like a charm.

Works really well, I also thought about controlling the color using rotation, but it would require using the HSV color space, and I am not sure if and how to convert rgb to hsv direct into HA.

Yeah I was trying to figure out a way to rotate through colors with the flip180 event but i’m a beginner so i don’t have the slightest how to go about that

protocol version 1.0.7 brings support of curtains. Xiaomi API v.1.0.7

Wireless switch 86 double
Attributes
Description
Channel_0
Click Left click
Double_click Left double click

Channel_1
Right-click-click
Right double-click double_click

Dual_channel
Both_click Left and right keys at the same time press

Attribute escalation:
{“Cmd”: “report”, “model”: “86sw2”, “sid”: “112316”, “short_id”: 4343, “data”: "{" channel_0 \ ": " click \ "} }

By sending “write” way “virtual event” (the “virtual event” only work inside the gateway, not reported to the millet cloud), in order to trigger a local linkage (automation) associated with the event can be performed:
{“Cmd”: “write”, “model”: “86sw2”, “sid”: “112316”, “short_id”: 4343, “data”: "{" channel_1 \ ": " double_click \ “}” }

.

V1.0.7 New: You can “write” on the Rubik’s Cube, 86 wireless switch and wireless switch, in order to create a “virtual event”

Does this mean Aqara switches can support double_click inside HA?

Aqara and Eigenstone are two brands of lumiunited (eigenstone brand is printed inside new aqara sensors).
Why will exist two brands, wild guess, one for selling with xiaomi/mijia, another for lumiunited alone.

eigenstone has a chinese site with some new products not anounced yet. a light relay switch, natural gas alarm and fire alarm without Honeywell branding… a camera (with wrong model id)

Opening page has all the product family
http://www.eigenstone.com/html/home.html

Flooding sensor (finaly :smile: )

Natural Gas Alarm

Fire Alarm

Light Relay switch Zigbee

IP Camera

and github page
https://github.com/eigenstone

1 Like

The “double_click” event arrives the xiaomi component of HA but it’s not implemented so far.

I believe you are wrong. I am using a double click event in an automation with the original xiaomi switch.

Double_click event implemented.

class XiaomiButton(XiaomiDevice, BinarySensorDevice):
    """Representation of a Xiaomi Button."""

    def __init__(self, device, name, data_key, hass, xiaomi_hub):
        """Initialize the XiaomiButton."""
        self._is_down = False
        self._hass = hass
        self._data_key = data_key
        XiaomiDevice.__init__(self, device, name, xiaomi_hub)

    @property
    def is_on(self):
        """Return true if sensor is on."""
        return self._is_down

    def parse_data(self, data):
        """Parse data sent by gateway"""
        value = data.get(self._data_key)
        if value is None:
            return False

        if value == 'long_click_press':
            self._is_down = True
            click_type = 'long_click_press'
        elif value == 'long_click_release':
            self._is_down = False
            click_type = 'hold'
        elif value == 'click':
            click_type = 'single'
        elif value == 'double_click':
            click_type = 'double'

        self._hass.bus.fire('click', {
            'entity_id': self.entity_id,
            'click_type': click_type
        })
        if value in ['long_click_press', 'long_click_release']:
            return True
        return False

Both_click is not implemented for 86sw2 (wall double switch).

1 Like

According to new protocol specification Magnet sensor and Motion sensor can report their state as unknown. For example after reboot or power outage until next heart_beat arrive (~60 sec).
How do you think do we need to show this state in UI?
Currently this state is ignored.

The state should be sat to None, then it will show up as Unknown in the frontend.

1 Like

BTW gas and fire sensors got alarm attribute extension