I’m experiencing a strange variation of this issue too.
I just made a new installation of HomeAssistant on my retired RedMi 3S smartphone (with Linux Deploy) and configured to access XiaoMi devices, all are with the latest versions.
I have single XiaomMi gateway.
On the Web GUI of HomeAssistant, I can turn on/off the wall_switch (ZigBee) successfully, but failed for gateway_light — received “Invalid key” in the Log when doing it.
INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_on, service_call_id=4127306160-28, service_data=entity_id=light.gateway_light_7811dcb1f997>
INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_call_id=4127306160-29, service_data=entity_id=['light.gateway_light_7811dcb1f997']>
ERROR:xiaomi_gateway:Got error element in data {"error":"Invalid key"}
INFO:homeassistant.core:Bus:Handling <Event system_log_event[L]: message=Got error element in data {"error":"Invalid key"}, source=components/light/xiaomi_aqara.py, timestamp=1519585983.445348, level=ERROR, exception=>
ERROR:xiaomi_gateway:Got error element in data {"error":"Invalid key"}
INFO:homeassistant.core:Bus:Handling <Event system_log_event[L]: message=Got error element in data {"error":"Invalid key"}, source=components/light/xiaomi_aqara.py, timestamp=1519585983.4641218, level=ERROR, exception=>
INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=4127306160-29>
INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=4127306160-28>
INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_off, service_call_id=4127306160-30, service_data=entity_id=switch.wall_switch_158d00016c5e82>
INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=switch, service=turn_off, service_call_id=4127306160-31, service_data=entity_id=['switch.wall_switch_158d00016c5e82']>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state switch.wall_switch_158d00016c5e82=off; icon=mdi:power-socket, battery_level=100.0, friendly_name=Wall Switch_158d00016c5e82 @ 2018-02-26T03:13:13.252149+08:00>, old_state=<state switch.wall_switch_158d00016c5e82=on; icon=mdi:power-socket, battery_level=100.0, friendly_name=Wall Switch_158d00016c5e82 @ 2018-02-26T03:06:41.163205+08:00>, entity_id=switch.wall_switch_158d00016c5e82>
INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=4127306160-31>
INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=4127306160-30>