不知道哪里出问题了,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%
|