litinoveweedle / SmartIR

⏻ Control Home Assistant climate, fan, media_player and light devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome, ZHA)
MIT License
108 stars 31 forks source link

Referenced entities are missing or not currently available #86

Closed Burstofinsanity closed 3 months ago

Burstofinsanity commented 3 months ago

Home Assistant version 2024.7.3

SmartIR version : 1.17.16

SmartIR configuration SmartIR Climate with ESPHome

ESPHome config:
`esphome:
  name: aircon01
  friendly_name: Aircon 01

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "##############"
  services:
  - service: send_raw_command
    variables:
      command: int[]
    then:
      - remote_transmitter.transmit_raw:
          code: !lambda 'return command;'

ota:

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
  - ssid: !secret wifi_ssid2
    password: !secret wifi_password2

  ap:
    ssid: "Esphome-Web-537Ec4"
    password: "#########"

captive_portal:

remote_transmitter:
  pin: 25
  carrier_duty_percent: 50%`

HA configuration.yaml

default_config:

tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
media_source: /media/local

climate:
  - platform: smartir
    name: Office AC
    unique_id: office_ac
    device_code: 1386
    controller_data: esphome.aircon_01_send_raw_command

Describe the bug

When the service from SmartIR is called to ESPHome it says the entity is missing, but if i test it through the developer console it works fine, i have hooked up a LED to see if the board is not defective but it is working fine.

Only through SmartIR it does not work.

Debug log

voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data['entity_id']
2024-07-22 14:11:38.454 ERROR (MainThread) [custom_components.smartir.climate] not a valid value for dictionary value @ data['entity_id']
Traceback (most recent call last):
  File "/config/custom_components/smartir/climate.py", line 591, in _send_command
    await self._controller.send(
  File "/config/custom_components/smartir/controller.py", line 117, in send
    await self.hass.services.async_call("remote", "send_command", service_data)
  File "/usr/src/homeassistant/homeassistant/core.py", line 2696, in async_call
    processed_data: dict[str, Any] = handler.schema(service_data)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/validators.py", line 229, in _run
    return self._exec(self._compiled, value, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/validators.py", line 355, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.12/site-packages/voluptuous/validators.py", line 353, in _exec
    v = func(path, v)
        ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable
    return schema(data)
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
    return base_validate(path, iteritems(data), out)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
    raise er.MultipleInvalid(errors)
litinoveweedle commented 3 months ago

Based on the original logs you posted you were not using this SW but original SmartIR project!

2024-03-06 10:38:41.904 WARNING (MainThread) [homeassistant.components.climate.const] HVAC_MODE_OFF was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.OFF instead, please report it to the author of the 'smartir' custom integration The current logs are not from the debug mode! Please provide complete debug log.

litinoveweedle commented 3 months ago

On top of that config validation raise error

voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data['entity_id']

Please list the entity esphome.aircon_01_send_raw_command in the HA Developers tools -> States

litinoveweedle commented 3 months ago

Moreover I see where is your problem. Your device file is not suitable for the ESPhome, as if you will look into the file you will see:

  "commandsEncoding": "Base64",
  "supportedController": "Broadlink",

Therefore you need to create device file compatible with your controller. Closing as invalid.