Control Remoto RF led pixel 2812

Tags: #<Tag:0x00007fc416b674e8>

control pixel
hi i need help i’m newbie at this. I have a rf remote control that has many functions that are accessed by pressing the same key several times: example with the mode + key I advance with the same rf command through the internal menu of the device until I reach the desired function.
I have captured the rf commands of each function as follows:
I have created a switch with the name, from mode +
switch:
#MODE+
- platform: mqtt
name: “controlPixel_Mode+”
command_topic: “cmnd/RFBridge/Backlog”
availability_topic: “tele/RFBridge/LWT”
payload_available: “Online”
payload_not_available: “Offline”
state_topic: “tele/RFBridge/RESULT”
payload_on: “RfSync 12210; RfLow 450; RfHigh 1230; RfCode #B04009
payload_off: “RfSync 12210; RfLow 450; RfHigh 1230; RfCode #B04009_off
state_on: “#B04009
state_off: “#B04009_off
optimistic: true
retain: false
qos: 1

I want to create a new swich, for example color fuxia, that contains the rf command of the color blue and through a script execute 2 times the command mode +. I have tried by all means but I surpass myself.
now I have created a script that I have named fuxia color:

scritp:
switchcontrolpixel_fuxia:
alias: switchcontrolpixel_fuxia
sequence:

  • service: switch.turn_on
    target:
    entity_id: switch.controlpixel_azul
  • repeat:
    count: ‘1’
    sequence:
    • service: switch.turn_on
      target:
      entity_id: switch.controlgenerico_mode_2
      mode: single

I need to turn this into a swich. who can help me? tnk

Please format your code it as we can’t read it

but

- platform: mqtt
name: “controlPixel_Mode+”
command_topic: “cmnd/RFBridge/Backlog”
availability_topic: “tele/RFBridge/LWT”
payload_available: “Online”
payload_not_available: “Offline”
state_topic: “tele/RFBridge/RESULT”
payload_on: “RfSync 12210; RfLow 450; RfHigh 1230; RfCode #B04009”
payload_off: “RfSync 12210; RfLow 450; RfHigh 1230; RfCode #B04009_off”
state_on: “#B04009”
state_off: “#B04009_off”
optimistic: true
retain: false
qos: 1

the way I do its

I script it

this my script to turn on/off my garageTV

garage_ir_tv:
  sequence:
  - data_template:
      payload: '{"Protocol":"PANASONIC","Bits":48,"Data":"0x40040100BCBD"}'
      topic: cmnd/IR/irsend
    service: mqtt.publish

also I have a Sensor Last IR

- platform: mqtt
  name: "Last IR"
  state_topic: "tele/IR/RESULT"
  value_template: "{{value_json.IrReceived.Data}}"
  expire_after: 1
  qos: 1

and with the expire_after: 1 it forgets it after 1 sec
so now I can create a automation when i Press a buttom on the IR remote

only problem its goes to Unavailable to quick so i have a other one then 30sec

- platform: mqtt
  name: "Last IR30"
  state_topic: "tele/IR/RESULT"
  value_template: "{{value_json.IrReceived.Data}}"
  expire_after: 30
  qos: 1

Once i have the code I write the automation
its a the rec one on the remote

- id: IR remote Toggle Kettle
  alias: IR remote Toggle Kettle
  trigger:
  - entity_id: sensor.last_ir
    platform: state
    to: '190A332'
  condition: []
  action:
  - data:
      entity_id: switch.kettle_power
    service: switch.toggle