Anonym-tsk / home-assistant-components

Custom components for Home Assistant
29 stars 5 forks source link

Xiaomi remote climate not work after v80.0 update #5

Closed vietdht closed 5 years ago

vietdht commented 5 years ago

Please help to check, I have this error after update to HA 0.80 AttributeError: module 'homeassistant.components.remote' has no attribute 'send_command'

vietdht commented 5 years ago

@bind_hass def send_command(hass, command, entity_id=None, device=None, num_repeats=None, delay_secs=None) has been remove from /remote/__init__.py So I try to add it again and it works, don't know if there is any official fix?

thundergreen commented 5 years ago

@vietdht where di u change this? Which file. Mine is also broken after updating to 0.80.0

Could you please make a step by tep guide how u fixed it.. i can'T find the code snippet u posted.

vietdht commented 5 years ago

@thundergreen I installed HA on raspian, for me, it located at /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/remote/__init__.py you can add below code at line 71

@bind_hass
def send_command(hass, command, entity_id=None, device=None,
                 num_repeats=None, delay_secs=None):
    """Send a command to a device."""
    data = {ATTR_COMMAND: command}
    if entity_id:
        data[ATTR_ENTITY_ID] = entity_id

    if device:
        data[ATTR_DEVICE] = device

    if num_repeats:
        data[ATTR_NUM_REPEATS] = num_repeats

    if delay_secs:
        data[ATTR_DELAY_SECS] = delay_secs

    hass.services.call(DOMAIN, SERVICE_SEND_COMMAND, data)
thundergreen commented 5 years ago

@vietdht Not sure if this component has been fixed with latest commits? Could the author please give a Statement ;) I need it urgently as I will get another nice feature in a further Beta 0.80.x fir this I need this running as well ;)

vietdht commented 5 years ago

@thundergreen latest commit seems not work for me, it's broken at init steps. Keep using my alternative solution :( with 0.80.1

thundergreen commented 5 years ago

Thanks reporting back. I'm wondering why the author doesn't take a word here ?

thundergreen commented 5 years ago

@vietdht Custom component broke again with latest release 0.84.1. I will not upgrade as I need this component urgently. DO you have an idea whats going on this time? Using the workaround doesn'T seem to work anymore.

Cheers

Anonym-tsk commented 5 years ago

@vietdht Please update component from github and try again. It should work.