Have you copied the component to the custom_components folder?
Yes.
This is what my folder looks like (so you che check if everything is ok):
I created a empy folder called “custom_components” and then copied the elements inside the file .zip .
Thank you
That is not correct.It should be custom_components/xiaomi.py, custom_components/sensor/xiaomi.py, …
Described here: https://github.com/lazcad/homeassistant#installation-raspberry-pi
Sorry. I change all and try again.
Thank you!
Hey guys,
trying to add a dimmer for my livingroom yeelight using the cube. Iam new to HASS, so please be patient
Ok. My ~/.homeassistant/automation/lights/wohnzimmer_dimmer.yaml so far:
#### AUTOMATION - LIGHTS - WOHNZIMMER - DIMMER ##################################
alias: Wohnzimmer Licht DIMMER
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d00010d110b
action_type: rotate
action:
service:
notify.telegramnofity
data:
title: Test
message: >
{{ trigger.event.data.action_value|float }}
For testing i just want to telegram the acton_value to my bot.
But i got this error:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 99, in async_render
return self._compiled.render(kwargs).strip()
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/sandbox.py", line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'trigger' is undefined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1001, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/notify/__init__.py", line 133, in async_notify_message
kwargs[ATTR_MESSAGE] = message.async_render()
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 101, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'trigger' is undefined
I realy dont know what i am doing wrong?
Is this your only automation? If not, express them as a list by prefixing “alias” with a -
- alias: Wohnzimmer Licht DIMMER
trigger: .....
Also - it looks like you may have tabs instead of spaces. YAML cares about that. Set your text editor to use spaces instead of tabs.
Any one know if can i make the switch button on/off via ha?
As for now he just show on HA without to make anything.
Thanks!
MP
Hi,
edit: … for anyone reading that has the same problem, the solve is at the end of this post…
I do not have an Apple device. I downloaded the app from here on Google Play, which is where the QR code in the Xiaomi box led me to. I’m failing to understand how to activate developer mode in this app.
All files are in /home/homeassistant/.homeassistant/custom_components
… I have this device and two of these devices.
##config.yaml
...
xiaomi:
gateways:
- sid:
key: xxxxxxxxxxxxxxxx
...
##log result
17-03-11 19:47:06 WARNING (Thread-6) [custom_components.xiaomi] Gateway Key is not provided. Controlling gateway device will not be possible.
17-03-11 19:47:21 ERROR (Thread-6) [custom_components.xiaomi] No gateway discovered
17-03-11 19:47:21 ERROR (MainThread) [homeassistant.bootstrap] component xiaomi failed to initialize
I don’t really care yet to control the gateway. The app in this link does not have the same UI as the app I am using. The gateway is set up and showing 2 connected devices in my app. I purchased and paired 2 door sensors.
Tapping on the gateway does nothing. Nothing in my settings panel helps me configure the gateway.
Thank you for any help you provide,
- SN
SOLVE: Well this is pretty insane from a UX standpoint, but it looks like within the app, the Chinese Mainland option shows a completely different UI from the United States option. Changing my Locale to Chinese Mainland seemed to do the trick and solve my problem.
Hi Daniel,
I’ve done what you kindly suggest me.
Now It seems that I can load the custom component but I’m still unable to use the xiaomi gateway.
Below the error:
17-03-12 00:20:31 INFO (MainThread) [homeassistant.bootstrap] Setting up xiaomi
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Expecting 1 gateways
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 1)
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Xiaomi Gateway 286c0788ab7e found at IP 192.168.2.13
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Devices
17-03-12 00:20:31 DEBUG (Thread-1) [custom_components.xiaomi] >> b'{"cmd" : "get_id_list"}'
17-03-12 00:20:31 DEBUG (Thread-1) [custom_components.xiaomi] << {'data': '["158d000159edf6","158d00015af2d3","158d0001584132","158d00010b2b6b","158d00011c7c9e"]', 'token': 't6sRYEBP8AJy9iwR', 'sid': '286c0788ab7e', 'cmd': 'get_id_list_ack'}
17-03-12 00:20:31 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component xiaomi
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 153, in _async_setup_component
None, component.setup, hass, config)
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/xiaomi.py", line 77, in setup
PY_XIAOMI_GATEWAY.discover_gateways()
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 167, in discover_gateways
self.gateways[ip_add] = XiaomiGateway(ip_add, port, sid, gateway_key, self._socket)
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 262, in __init__
if self._discover_devices():
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 271, in _discover_devices
self.update_key(resp["token"])
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 370, in update_key
encryptor = AES.new(self.key.encode(), AES.MODE_CBC, IV=init_vector)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/AES.py", line 59, in __init__
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/blockalgo.py", line 141, in __init__
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Key cannot be the null string
17-03-12 00:20:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=title=Invalid config, notification_id=invalid_config, message=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config, service=create, service_call_id=1978650448-1, domain=persistent_notification>
17-03-12 00:20:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config; title=Invalid config @ 2017-03-12T00:20:31.697242+01:00>, entity_id=persistent_notification.invalid_config, old_state=None>
Please notice that I’ve added the key from the Mi Home into the configuration.yaml
xiaomi:
gateways:
- sid: Xiaomi Gateway
key: xxxxxxxxxxxxx
Thank you in advance
only work on zigbee version of power plug? how to control gateway light or radio, can’t see any gateway on frontend
The gateway light comes up in my system as Gateway Light_xxxxxxxxxxx, where I assume xxxxxxxx is unique to my device.
I haven’t seen any way of making the radio work with HASS, but there are ways to make it work wit your own music if you google.
Thanks for your advice!
There are no tabs in the real config, i promise Just needed to justify the code for the forum.
Yes, my automation files are splitted. I load them via !include_dir_list like discribed in the doku (https://home-assistant.io/docs/configuration/splitting_configuration/). So i belive i dont need “-”? In general the automations seem to work.
Anyway, why is my “trigger” undefined? In examples like Xiaomi Gateway Integration it seems to work?
Try using the MAC-adress of the gateway as SID (lowercase, no colon (double point)) or leave it empty. Check https://github.com/lazcad/homeassistant#installation-raspberry-pi
It Worked! THANK YOU!
Hey folks. Just got my V2 gateway from china (after a mishap receiving V1 GW) and want to get this baby installed.
I’m using docker for HA. Does anyone know if there is any guide to install custom components (or specifically the xiaomi component) with Docker?
I searched in this thread for “Docker” and from some posts in the thread (some of which are quite old) it appears that the approach is to hack the docker image to copy in the custom component.
Is this the way that HA needs this to be done? I was thinking it would be possible to map a volume instead (in same way that the config dir volume is mapped).
Any pointers gratefully received. Thanks!
hi all,
how to turn on the alarm of gateway with door sensor?
Thanks
Where do you have your configuration? You just need to place the component files in a folder named custom_components, which should be on the same directory of your HA config files.
Thanks @abmantis. That’s fantastic news. I saw a post from @rave mentioning it might be implemented but did see any follow to confirm.
Great. worked 1st time no messing about I can see sensor events in the HA log
This is what I did for Docker based install. (as sudoed user)
cd
mkdir custom_components
cd custom_components
sudo git clone https://github.com/lazcad/homeassistant
then I moved the contents of /custom_components/homeassistant/components back two dirs so that everything is in /custom_components… not sure if this is necessary, but the github readme says to copy all the files into the Home Assistant location/custome_components dir.
Before I buy, does anyone know if the Xiaomi Mi Smart Power Strip with 6 outlets (http://www.gearbest.com/plugs-sockets/pp_609502.html?wid=21) can be controlled via Home Assistant?
I know the single one can be.