Hi
I’m thinking about how to design at best and easier way some TV favorites with HA. Here is the concept: Satellite box controlled by Infrared with ESPHome. I want to add some buttons in Lovelace for my favorites TV Channel that when I push it dials automatically in infrared the channel number on satellite box.
IR control with ESPHome works already perfect.
I’m looking now for the best and easier way to implement that between HA and ESPHome I have created a link between HA and ESPHome so I get the channel number requested straight in ESPHome.
Now I need to handle that value to get separately the hundred, tenth and units numbers separately so I can dial appropriate IR codes. Is it possible to do such manipulation in ESPHome or might be too complicated ?
Sorry forgot to paste my current sketch, here it is below
substitutions:
friendly_name: irblaster
esphome:
name: $friendly_name
esp32:
board: esp32dev
framework:
type: arduino
logger:
web_server:
ota:
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_passwd
ap:
ssid: $friendly_name
manual_ip:
static_ip: 172.16.2.82
gateway: 172.16.1.1
subnet: 255.255.252.0
captive_portal:
globals:
- id: digit_to_dial
type: int
restore_value: no
initial_value: '0'
api:
reboot_timeout: 120min
services:
- service: Channel_favorites
variables:
my_favorite: int
then:
- switch.execute: script_principal
sensor:
- platform: wifi_signal
name: $friendly_name WiFi Signal
update_interval: 60s
- platform: uptime
name: $friendly_name Uptime
filters:
- lambda: return x / 60.0;
unit_of_measurement: minutes
remote_receiver:
id: ir_receiver
pin:
number: GPIO23
inverted: True
idle: 25ms
dump: all
tolerance: 50%
remote_transmitter:
pin: GPIO2
carrier_duty_percent: 50%
script:
- id: script_principal
mode: restart
max_runs: 1
then:
- if:
condition:
number.in_range:
id: my_favorite
above: 99.0
then:
- lambda: |-
id(digit_to_dial) = my_favorite/100;
script:
- id: composition
mode: restart
max_runs: 1
switch:
- platform: template
name: "Power"
id: Sky_Power
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0059 0015 06C3"
- platform: template
name: "1"
id: Sky_1
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015D 0056 0017 06C3"
- platform: template
name: "2"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "3"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "4"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0017 06C3"
- platform: template
name: "5"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "6"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "7"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0059 0015 06C3"
- platform: template
name: "8"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015D 0056 0016 06C3"
- platform: template
name: "9"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "0"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Info"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Settings"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Mute"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Vol+"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Vol-"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Apps"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "USB"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Page+"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Page-"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Menu"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Exit"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Up"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Down"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Left"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Right"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0059 0015 06C3"
- platform: template
name: "OK"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Star"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Star+"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Setup"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Search"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0017 06C3"
- platform: template
name: "Previous"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Play / Pause"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Next"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0059 0015 06C3"
- platform: template
name: "Rewind"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015D 0056 0017 06C3"
- platform: template
name: "Forward"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Stop"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Record"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Red / TV"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Green / VOD"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
- platform: template
name: "Yellow / Music"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015B 0058 0015 06C3"
- platform: template
name: "Blue / Radio"
turn_on_action:
- remote_transmitter.transmit_pronto:
data: "0000 006D 0002 0000 015C 0057 0016 06C3"
Thanks for your ideas and suggestions
Vincèn