『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1093|回复: 4

[技术探讨] 求助红外遥控插件smartIR出错

[复制链接]

1

主题

35

帖子

180

积分

注册会员

Rank: 2

积分
180
金钱
145
HASS币
0
发表于 2022-1-5 21:32:35 | 显示全部楼层 |阅读模式
不知道哪里出问题了,ha中直接调用服务直接发红外CODE 正常,添加卡片使用时没有反应,日志报错Unable to find service remote.send_command

此错误来自自定义集成。
Logger: custom_components.smartir.media_player
Source: core.py:1442
Integration: SmartIR (documentation)
First occurred: 21:12:27 (1 occurrences)
Last logged: 21:12:27

Unable to find service remote.send_command
Traceback (most recent call last):
  File "/config/custom_components/smartir/media_player.py", line 289, in send_command
    await self._controller.send(command)
  File "/config/custom_components/smartir/controller.py", line 111, in send
    await self.hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1442, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service remote.send_command

conf配置如下:

smartir:
  check_updates: false

media_player:
  - platform: smartir
    name: Living room TV
    unique_id: living_room_tv
    device_code: 1000
    controller_data: ir_tem_send_raw_command
    power_sensor: switch.light_power


esp配置如下:
api:
  services:
    - service: send_raw_command
      variables:
        command: int[]
      then:
        - remote_transmitter.transmit_raw:
            code: !lambda 'return command;'
            carrier_frequency: 38kHz
    - service: send_nec_command
      variables:
        address: int
        command: int
      then:
        - remote_transmitter.transmit_nec:
            address: !lambda 'return address;'
            command: !lambda 'return command;'


switch:

  - platform: template
    name: "light_power"
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [9195, -4490, 645, -1621, 668, -519, 627, -496, 646, -499, 647, -498, 648, -515, 627, -517, 628, -492, 652, -518, 626, -1648, 640, -1640, 649, -1639, 651, -1664, 625, -1645, 644, -1640, 650, -1662, 627, -499, 644, -501, 645, -518, 627, -499,
646, -517, 627, -518, 627, -516, 628, -522, 621, -1644, 645, -1649, 641, -1642, 647, -1663, 628, -1662, 625, -1663, 628, -1662, 626, -1663, 626]
          carrier_frequency: 38kHz

  - platform: template
    name: "night_power"
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [9191, -4479, 665, -1622, 649, -494, 665, -486, 645, -501, 653, -499, 635, -489, 654, -495, 648, -495, 649, -491, 673, -1640, 629, -1658, 628, -1636, 661, -1652, 626, -1641, 661, -1647, 629, -1659, 629, -495, 647, -1661, 626, -1643, 658, -506, 629, -498, 654, -489, 649, -511, 632, -512, 637, -1651, 627, -517, 632, -512, 625, -1643, 652, -1656, 626, -1661, 631, -1658, 625, -1645, 642]
          carrier_frequency: 38kHz
  - platform: template
    name: "power100%"
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [9183, -4485, 640, -1677, 620, -484, 653, -496, 656, -503, 643, -495, 645, -509, 634, -511, 631, -516, 625, -493, 652, -1685, 607, -1637, 652, -1639, 650, -1636, 656, -1673, 602, -1692, 611, -1642, 634, -1655, 640, -1650, 627, -521, 627, -1662, 620, -524, 628, -511, 637, -507, 629, -515, 635, -509, 637, -489, 648, -1641, 645, -500, 652, -1653, 624, -1654, 638, -1663, 623, -1686, 606]
          carrier_frequency: 38kHz

  - platform: template
    name: "tv_power"
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [9077, -4473, 620, -545, 625, -525, 640, -1583, 639, -529, 638, -526, 641, -523, 646, -534, 631, -549, 619, -1602, 620, -1602, 622, -545, 621, -1602, 620, -1578, 644, -1578, 643, -1600, 621, -1603, 620, -547, 620, -524, 644, -534, 633,-1582, 640, -524, 643, -549, 619, -545, 623, -547, 620, -1581, 642, -1605, 615, -1603, 620, -527, 641, -1590, 633, -1601, 620, -1602, 620, -1602, 625]
          carrier_frequency: 38kHz
  - platform: template
    name: "tvbox_power"
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [9034, -4422, 578, -1646, 577, -563, 580, -511, 570, -571, 565, -550, 559, -539, 558, -581, 536, -553, 587, -533, 578, -1656, 563, -1671, 567, -1667, 572, -1686, 560, -1652, 560, -1695, 543, -1672, 582, -517, 579, -575, 563, -533, 574, -571,539, -571, 546, -571, 552, -1657, 585, -557, 557, -1656, 588, -1666, 552, -1683, 537, -1697, 561, -1675, 561, -1671, 548, -572, 534, -1699, 556]
          carrier_frequency: 38kHz


remote_receiver:
  pin:
    number: GPIO12
    inverted: True
  dump: raw

remote_transmitter:
  pin:
    number: GPIO16
  carrier_duty_percent: 50%   

回复

使用道具 举报

101

主题

2887

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
11529
金钱
8577
HASS币
460

教程狂人突出贡献

发表于 2022-1-6 20:49:58 | 显示全部楼层
说的很清楚啊!“Unable to find service remote.send_command”。

smartir需要配合可直接接入HA的红外发射装置,比如小米的万能遥控器,不是esphome的。
回复

使用道具 举报

1

主题

35

帖子

180

积分

注册会员

Rank: 2

积分
180
金钱
145
HASS币
0
 楼主| 发表于 2022-1-6 21:15:50 来自手机 | 显示全部楼层
smart官网上是支持esphome的啊,配置是按照说明配置的,不知道哪里还有问题
回复

使用道具 举报

101

主题

2887

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
11529
金钱
8577
HASS币
460

教程狂人突出贡献

发表于 2022-1-6 22:23:43 | 显示全部楼层
哦?好久没关注了,smartir出新版本支持esphome红外发射器了?很好的功能啊!哪天我也试试

不过你的错误日志显示还是去寻找ha标准的红外遥控器服务,没找到所以报错了。莫非你用的smartir还是旧版本?还是你的esphome节点名称并非“ir_tem”?
回复

使用道具 举报

1

主题

35

帖子

180

积分

注册会员

Rank: 2

积分
180
金钱
145
HASS币
0
 楼主| 发表于 2022-1-7 19:37:42 | 显示全部楼层
本帖最后由 yulijie 于 2022-1-7 19:42 编辑
XCray 发表于 2022-1-6 22:23
哦?好久没关注了,smartir出新版本支持esphome红外发射器了?很好的功能啊!哪天我也试试

不过你的错误日 ...

项目在这 https://github.com/smartHomeHub/SmartIR
示例如下
Example (using ESPHome):
ESPHome configuration example:

esphome:
  name: my_espir
  platform: ESP8266
  board: esp01_1m

api:
  services:
    - service: send_raw_command
      variables:
        command: int[]
      then:
        - remote_transmitter.transmit_raw:
            code: !lambda 'return command;'

remote_transmitter:
  pin: GPIO14
  carrier_duty_percent: 50%
HA configuration.yaml:

smartir:

media_player:
  - platform: smartir
    name: Living room TV
    unique_id: living_room_tv
    device_code: 2000
    controller_data: my_espir_send_raw_command
    power_sensor: binary_sensor.tv_power


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-10 15:54 , Processed in 0.165682 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表