smartHomeHub / SmartIR

Integration for Home Assistant to control climate, TV and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome)
MIT License
2.06k stars 1.01k forks source link

Not working #11

Closed cubilon closed 5 years ago

cubilon commented 5 years ago

Hi Vassilis, I'm unable to make it work on HA version 0.88.1.


Feb 23 10:26:14 raspberrypi hass[11779]: 2019-02-23 10:26:14 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.climate.smartir. Make sure all dependencies are installed
Feb 23 10:26:14 raspberrypi hass[11779]: Traceback (most recent call last):
Feb 23 10:26:14 raspberrypi hass[11779]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 147, in _load_file
Feb 23 10:26:14 raspberrypi hass[11779]:     module = importlib.import_module(path)
Feb 23 10:26:14 raspberrypi hass[11779]:   File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
Feb 23 10:26:14 raspberrypi hass[11779]:     return _bootstrap._gcd_import(name[level:], package, level)
Feb 23 10:26:14 raspberrypi hass[11779]:   File "<frozen importlib._bootstrap>", line 986, in _gcd_import
Feb 23 10:26:15 raspberrypi hass[11779]:   File "<frozen importlib._bootstrap>", line 969, in _find_and_load
Feb 23 10:26:15 raspberrypi hass[11779]:   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
Feb 23 10:26:15 raspberrypi hass[11779]: ImportError: No module named 'custom_components.climate.smartir'; 'custom_components.climate' is not a package
Feb 23 10:26:15 raspberrypi hass[11779]: 2019-02-23 10:26:15 ERROR (MainThread) [homeassistant.loader] Unable to find platform smartir
Feb 23 10:26:15 raspberrypi hass[11779]: 2019-02-23 10:26:15 ERROR (MainThread) [homeassistant.config] Invalid config for [climate]: required key not provided @ data['controller_send_service']. Got None
Feb 23 10:26:15 raspberrypi hass[11779]: required key not provided @ data['device_code']. Got None. (See /home/homeassistant/.homeassistant/climates.yaml, line 6). Please check the docs at https://home-assistant.io/components/climate/
Feb 23 10:26:15 raspberrypi hass[11779]: 2019-02-23 10:26:15 INFO (MainThread) [homeassistant.setup] Setting up climate
Feb 23 10:26:15 raspberrypi hass[11779]: 2019-02-23 10:26:15 ERROR (MainThread) [homeassistant.setup] Error during setup of component climate
Feb 23 10:26:15 raspberrypi hass[11779]: Traceback (most recent call last):
Feb 23 10:26:15 raspberrypi hass[11779]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 154, in _async_setup_component
Feb 23 10:26:15 raspberrypi hass[11779]:     component.setup, hass, processed_config)  # type: ignore
Feb 23 10:26:15 raspberrypi hass[11779]: AttributeError: module 'custom_components.climate' has no attribute 'setup'

My config is:

climate:
  - platform: smartir
    name: Mitsubishi
    device_code: 1221
    controller_send_service: switch.broadlink_send_packet_192_168_1_40 
    power_sensor: binary_sensor.hvac_power

Of course switch.broadlink_send_packet_192_168_1_40 exists, so does binary_sensor.hvac_power. Code 1221 is a custom of mine made with your conversion tool.

One very strange thing is that another integration stopped working, this one: https://www.home-assistant.io/components/climate.eq3btsmart/

Got one entity configured and working, but when I try using your custom component SmartIR, it stops working (but I don't have errors on my logs).When I put back your deprecated version (and the previous configuration too), it works again.

smartHomeHub commented 5 years ago

This is a strange error. Could you setup the demo climate component and tell me if it works?

climate:
  platform: demo
cubilon commented 5 years ago

yes, it works: I got two other integrations working fine, Nest and Tado. The third, Eqiva, stop working if SmartIR is configured, as I told previously.

smartHomeHub commented 5 years ago

Could you send me the contents of climates.yaml?

cubilon commented 5 years ago

which one? old or new

smartHomeHub commented 5 years ago

New

cubilon commented 5 years ago
- platform: smartir
  name: Mitsubishi
  device_code: 1221
  controller_send_service: switch.broadlink_send_packet_192_168_1_90
  power_sensor: binary_sensor.power_status

- platform: eq3btsmart
  devices:
    bagno:
      mac: '00:1A:22:FC:1A:E1'
smartHomeHub commented 5 years ago

You are using the last ver of HA, right?

cubilon commented 5 years ago

sure, 0.88.1 installed standalone on Raspbian.

smartHomeHub commented 5 years ago

In Python virtual environment?

cubilon commented 5 years ago

yes 👍

smartHomeHub commented 5 years ago

I tried all the above in the same environment. Everything works fine here. Give me some time to search it further.

cubilon commented 5 years ago

sure! please check, on indomus.it we’re waiting to publish an article on SmartIR but we need do get a full test it before 👍

smartHomeHub commented 5 years ago

!!! Just yesterday found the article about Broadlink IR Climate in this site. It was amazing how detailed the instructions were.

cubilon commented 5 years ago

you deserve it!!

smartHomeHub commented 5 years ago

Thank you! Could you also try if this version works? https://github.com/smartHomeHub/SmartIR/blob/f8ecfd9c6c48d620466acf02a0fac6393dd548ff/smartir/climate.py

cubilon commented 5 years ago

can’t now :/ first thing tomorrow morning

smartHomeHub commented 5 years ago

No worries. Thanks for your help. I really appreciate it.

cubilon commented 5 years ago

no, thank YOU for your amazing work. I’ll update you soon.

cubilon commented 5 years ago

Hi there, I made a try: same behaviour

Feb 24 09:52:58 raspberrypi hass[4523]: 2019-02-24 09:52:58 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.climate.smartir. Make sure all dependencies are installed
Feb 24 09:52:58 raspberrypi hass[4523]: Traceback (most recent call last):
Feb 24 09:52:58 raspberrypi hass[4523]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 147, in _load_file
Feb 24 09:52:58 raspberrypi hass[4523]:     module = importlib.import_module(path)
Feb 24 09:52:58 raspberrypi hass[4523]:   File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
Feb 24 09:52:58 raspberrypi hass[4523]:     return _bootstrap._gcd_import(name[level:], package, level)
Feb 24 09:52:58 raspberrypi hass[4523]:   File "<frozen importlib._bootstrap>", line 986, in _gcd_import
Feb 24 09:52:58 raspberrypi hass[4523]:   File "<frozen importlib._bootstrap>", line 969, in _find_and_load
Feb 24 09:52:58 raspberrypi hass[4523]:   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
Feb 24 09:52:58 raspberrypi hass[4523]: ImportError: No module named 'custom_components.climate.smartir'; 'custom_components.climate' is not a package
Feb 24 09:52:58 raspberrypi hass[4523]: 2019-02-24 09:52:58 ERROR (MainThread) [homeassistant.loader] Unable to find platform smartir
Feb 24 09:52:58 raspberrypi hass[4523]: 2019-02-24 09:52:58 ERROR (MainThread) [homeassistant.config] Invalid config for [climate]: required key not provided @ data['controller_send_service']. Got None
Feb 24 09:52:58 raspberrypi hass[4523]: required key not provided @ data['device_code']. Got None. (See /home/homeassistant/.homeassistant/climates.yaml, line 6). Please check the docs at https://home-assistant.io/components/climate/
Feb 24 09:52:58 raspberrypi hass[4523]: 2019-02-24 09:52:58 INFO (MainThread) [homeassistant.setup] Setting up climate
Feb 24 09:52:58 raspberrypi hass[4523]: 2019-02-24 09:52:58 ERROR (MainThread) [homeassistant.setup] Error during setup of component climate
Feb 24 09:52:58 raspberrypi hass[4523]: Traceback (most recent call last):
Feb 24 09:52:58 raspberrypi hass[4523]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 154, in _async_setup_component
Feb 24 09:52:58 raspberrypi hass[4523]:     component.setup, hass, processed_config)  # type: ignore
Feb 24 09:52:58 raspberrypi hass[4523]: AttributeError: module 'custom_components.climate' has no attribute 'setup'

It' like boradlink switch loads after SmartIR, so this one can't find switch.broadlink_send_packet_192_168_1_90 becouse it's not yet loaded. I remember there's a way to tell HA when load a component, but I'm unable to recover how - can be useful tell HA to load SmartIR AFTER broadlink switch.

Btw, even this version os SmartIR breaks eqiva load.

smartHomeHub commented 5 years ago

Hi. Could you check if the component is placed under the right folder? (.homeassistant/custom_components/smartir/)

cubilon commented 5 years ago

Oh, my. It wasn't - I moved everything on smartir/ folder and now everything works. So I asked myself how I can be so stupid, so I checked back on the documentation. What I understood from the first picture in your post here:

https://community.home-assistant.io/t/smartir-climate-component/100798

is that you have to place everything under custom_components/, not custom_components/smartir. Am I wrong?

It is confusing to me :/ sorry if I wasted your time mate.

smartHomeHub commented 5 years ago

No worries. The custom_components folder structure is going to change from the last HA version. My picture was also wrong!

cubilon commented 5 years ago

Ok, I’ll keep in mind while writing about SmartIR on inDomus. 👍 thanks again Vas

smartHomeHub commented 5 years ago

I’m also going to release a new version today which there is no need for the user to create the codes/climate subfolder. The component detects if they are missing and creates them. Also if your device Json file is missing it is trying to download from the GitHub, automatically. So, if the device is already supported, you only need to provide the device code.

cubilon commented 5 years ago

more simple. great 👍