How to link an input select list to/from a modbus list of integers

This is the Yaml which links the input_select to the heatpump via modbus

alias: Energy State
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.energy_state_input_holding
    id: input
    to: null
  - platform: state
    entity_id:
      - input_select.wp_energy_state
    id: select
    to: null
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: input
        sequence:
          - variables:
              values:
                "0": 0. Not Use
                "1": 1. Forced Off
                "2": 2.Normal Operation
                "3": 3. On-recommandation
                "4": 4. On-command
                "5": 5. On-command step 2
                "6": 6. On-recommendation Step 1
                "7": 7. Energy Saving mode
                "8": 8. Super Energy Saving mode
          - service: input_select.select_option
            target:
              entity_id: input_select.wp_energy_state
            data:
              option: "{{ values.get(trigger.to_state.state) }}"
      - conditions:
          - condition: trigger
            id: select
        sequence:
          - service: modbus.write_register
            data_template:
              address: 9
              slave: 1
              hub: lg_modbus
              value: "{{ trigger.to_state.state[0] | int(0)  }}"