I’m trying to make device tracker works with the bluetooth of the RPi3. I make it happen but then I lost connection with the Xiaomi Gateway and my bulbs, they become unstables!
Any help? Will it work if I use a USB external bluetooth?
I’m trying to make device tracker works with the bluetooth of the RPi3. I make it happen but then I lost connection with the Xiaomi Gateway and my bulbs, they become unstables!
Any help? Will it work if I use a USB external bluetooth?
The bluetooth tracker on the RPi locks up HA. Don’t know if it will work with an external bluetooth dongle. Anyway, not an issue related to Xiaomi.
I’ve been meaning to try this one out but have been waiting until I have a back up in place.
@ToneStrife no, it will not work reliably even with an external dongle.
@BarryHampants I’ve fired it up and it does work without putting stress on the RPI or locking it up. But it does have bugs to iron out
New firmware update! It now reports voltage!!! Unfortunately after a power cut it still reports motion if it doesn’t receive any notification from the sensor.
With the new firmware, the battery level can now be reported to HA : https://github.com/Danielhiversen/homeassistant/blob/master/components/xiaomi.py#L425
Hello Daniel. Have you had a chance to check if play user defined ringtones option become available?
https://github.com/louisZL/lumi-gateway-local-api/blob/master/网关.md
Can anyone provide me a door open trigger example?
I have tried different commands but imposible to make it work. Thanks.
First - I’m using this as a sensor
- platform: template
sensors:
opening_door:
friendly_name: 'Front Door Sensor'
value_template: '{% if states.binary_sensor.door_window_sensor_158d00012aadbd.state == "on"%} Open {%- else -%} Closed {%- endif -%}'
And I have the automation set up as follows.
- alias: 'Front Door Opened'
trigger:
platform: state
entity_id: sensor.opening_door
to: 'Open'
condition:
condition: time
after: '10:00:00'
before: '19:30:00'
weekday:
- mon
- tue
- wed
- thu
- fri
# - sat
# - sun
action:
service: notify.sms_notify
data:
message: 'HASS: Front door has been opened. {{now().strftime("%d.%m.%Y-%H.%M")}}'
I think if you use sensor entity as
binary_sensor.door_window_sensor_158d00012aadbd
Your door open state will be ‘on’
to: 'on'
Battery levels not pushed to rave’s branch yet?
Hello Daniel.
I’m using your brach of component. Battery level is shown in debug log but I’m getting following errors:
17-04-01 14:16:40 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform xiaomi
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 153, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/sensor/xiaomi.py", line 23, in setup_platform
devices.append(XiaomiSensor(device, 'Temperature', 'temperature', gateway))
File "/home/homeassistant/.homeassistant/custom_components/sensor/xiaomi.py", line 36, in __init__
XiaomiDevice.__init__(self, device, name, xiaomi_hub)
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 391, in __init__
self.parse_voltage(device['data'])
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 425, in parse_voltage
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent)
AttributeError: 'XiaomiSensor' object has no attribute '_device_state_attributes'
Are there any other dependencies besides pycrypto that I might need to install?
I installed debian on a pc today and have got homeassistant up and running after some effort but can’t get xiaomi to connect. I’ve been using an AIO install on a pi up until now with all dependencies spoon fed.
Error in log is
17-04-01 22:44:04 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi is taking over 10 seconds. 17-04-01 22:44:09 ERROR (Thread-1) [custom_components.xiaomi] No gateway discovered 17-04-01 22:44:09 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize.
I have the exact same config on a raspberry pi on the same network and it is working. Have tried both branches here and restarted a bunch. Any ideas?
Check your firewall on your host. By default broadcast traffic is blocked. I had same issues on LiteLinux.
Nice! Time to play around. Since I’ll be out for trip for 2 weeks, any update i will post will likely be not tested. Need a few tester here
Thank you, for anyone looking…
sudo ifconfig eth0 multicast
It didn’t actually fix my problem right away but turning off the pi also running hass did. I guess you cant have two instances of hass connected at once.
Hi,
Mi Home just came out with a new app update and after the updated I stupidly clicked to update the firmware of the gateway to 1.4.1_144.0141.
Now everything has stopped working… They must have changed something. So a warning to others to not update…
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 153, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/sensor/xiaomi.py”, line 23, in setup_platform
devices.append(XiaomiSensor(device, ‘Temperature’, ‘temperature’, gateway))
File “/home/homeassistant/.homeassistant/custom_components/sensor/xiaomi.py”, line 36, in init
XiaomiDevice.init(self, device, name, xiaomi_hub)
File “/home/homeassistant/.homeassistant/custom_components/xiaomi.py”, line 391, in init
self.parse_voltage(device[‘data’])
File “/home/homeassistant/.homeassistant/custom_components/xiaomi.py”, line 425, in parse_voltage
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent)
AttributeError: ‘XiaomiSensor’ object has no attribute ‘_device_state_attributes’
17-04-02 01:30:55 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform xiaomi
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 153, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/binary_sensor/xiaomi.py”, line 36, in setup_platform
devices.append(XiaomiDoorSensor(device, gateway))
File “/home/homeassistant/.homeassistant/custom_components/binary_sensor/xiaomi.py”, line 141, in init
XiaomiDevice.init(self, device, ‘Door Window Sensor’, xiaomi_hub)
File “/home/homeassistant/.homeassistant/custom_components/xiaomi.py”, line 391, in init
self.parse_voltage(device[‘data’])
File “/home/homeassistant/.homeassistant/custom_components/xiaomi.py”, line 425, in parse_voltage
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent)
AttributeError: ‘XiaomiDoorSensor’ object has no attribute ‘_device_state_attributes’
Thanks, I’ll give a try!
I have same errors. I guess it related to message parsing. Functions to detect voltage are present in components but component can find information in right place.
I replaced Danielhiversen’s fork with the latest code from: https://github.com/lazcad/homeassistant and everything working with latest firmware, although I assume the ghost fix wont be in this code.
For those who is using Daniel brach I’ve created pull request:
https://github.com/Danielhiversen/homeassistant/pull/2
If you can’t wait merge you can apply fix yourself.
In xiaomi.py which is in custom_components folder you need to move up on to positions line self._device_state_attributes = {} (from line 392 to 390).
And you’ll get battery_level attribute in your sensors.