Setting timer for recording using broadlink RM4 Pro and cloner alliance

If this helps anyone. I had used Cloner Alliance pro but very hard to set up recording. Just needed a way to set length of time.
Kinda forget what I did but
Made script:

alias: Custom TV Timer
sequence:
  - variables:
      timer_hours: "{{ states('input_number.timer_hours') | int(default=0) }}"
      timer_minutes: "{{ states('input_number.timer_minutes') | int(default=0) }}"
      total_seconds: |
        {{ (timer_hours * 3600) + (timer_minutes * 60) }}
  - data:
      entity_id: timer.custom_timer
      duration: "{{ total_seconds }}"
    action: timer.start

Then on dashboard made new tab for recording and used this code

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_number.record_timer_hours
        name: Hour
        secondary_info: none
      - entity: input_number.record_timer_minutes
        name: Minutes
      - entity: input_boolean.recording_active
  - show_name: true
    show_icon: true
    type: button
    name: Start Recording
    show_state: true
    tap_action:
      action: call-service
      service: input_boolean.turn_on
      service_data:
        entity_id: input_boolean.recording_active

made 2 automations
Start Recording and Timer

alias: Start Recording and Timer
description: Starts recording and the timer when button is pressed
mode: single
triggers:
  - entity_id: input_boolean.recording_active
    to: "on"
    trigger: state
actions:
  - data_template:
      entity_id: timer.record_timer
      duration: >-
        {{ (states('input_number.record_timer_hours') | int * 3600) +
        (states('input_number.record_timer_minutes') | int * 60) }}
    action: timer.start
  - target:
      device_id: c3f787d8b2a0556e13eae7b8e68bca5c
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      device: USB DVR
      command: REC
    action: remote.send_command
  - data:
      message: Recording started for the specified duration.
    action: persistent_notification.create

Stop Recording After Timer

alias: Stop Recording After Timer
description: Stops the recording once the timer finishes
mode: single
triggers:
  - event_type: timer.finished
    event_data:
      entity_id: timer.record_timer
    trigger: event
actions:
  - target:
      device_id: c3f787d8b2a0556e13eae7b8e68bca5c
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      device: USB DVR
      command: REC
    action: remote.send_command
  - data:
      entity_id: input_boolean.recording_active
    action: input_boolean.turn_off
  - data:
      message: Recording has been stopped after the timer.
    action: persistent_notification.create

Need to change ID for start and stop record. Cloner Alliance uses same code
Made this set time wanted to record. Click start recording. Send signal through Broad link.
start Video.
After timer finishes will stop recording by sending broad link signal out again.
Might be an easier way but this has helped.