Migration of configuration to new approach - need help

Hi all,
i used to use HA, with template in configuration,
now after update all my home-PLC related buttons and sensors are gone, can anyone help with fixing configuration to ‘new type’?


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
scene: !include scenes.yaml
modbus:
  - name: modbus_hub
    type: tcp
    host: 192.168.0.100
    port: 502
    delay: 0
    message_wait_milliseconds: 500
    timeout: 1

    binary_sensors:
      # QX12.0 = 512
      - name: "SwTV1_status"
        slave: 1
        address: 512
        input_type: discrete_input
        scan_interval: 1

sensor:
 - platform: template
   sensors:
        power_total_used:
          unique_id: power_total_used
          value_template: >-
            {{ (states('sensor.shellyem3_08f9e047b2db_phase_a_power')|float(0) +
                            states('sensor.shellyem3_08f9e047b2db_phase_b_power')|float(0) +
                            states('sensor.shellyem3_08f9e047b2db_phase_c_power')|float(0) | round(0))}}
                
          unit_of_measurement: "W"
          device_class: power
        energy_total_used:
          unique_id: energy_total_used
          value_template: >-
            {{ (states('sensor.shellyem3_08f9e047b2db_phase_a_energy')|float(0)+
            states('sensor.shellyem3_08f9e047b2db_phase_b_energy')|float(0) +
            states('sensor.shellyem3_08f9e047b2db_phase_c_energy')|float(0))}}
          unit_of_measurement: "kWh"
          device_class: energy
          
        power_total_produced:
          unique_id: power_total_produced
          value_template: >-
            {{ (states('sensor.l1_moc')|float(0) +
                states('sensor.l2_moc')|float(0)|float(0)) | round(0) }}
          unit_of_measurement: "W"
          device_class: power
        energy_total_produced:
          unique_id: energy_total_produced
          value_template: >-
            {{ (states('sensor.opendtu_lukasz_yield_day')|float(0) /
                                                          float(1000) | round(0)) }}
          unit_of_measurement: "kWh"
          device_class: energy

 
 
rest_command:
  swtv1_off:
    url: "http://PLC/WRITEPI?ADR1=MB1&FORMAT1=%25d&VALUE1=0"
  swtv1_on:
    url: "http://PLC/WRITEPI?ADR1=MB1&FORMAT1=%25d&VALUE1=1"



switch:
  - platform: template
    switches:
      swtv1:
        friendly_name: "SwTV1"
        value_template: "{{ is_state('binary_sensor.SwTV1_status', 'on') }}"
        turn_on:
          service: script.swtv1_turn_on
        turn_off:
          service: script.swtv1_turn_off


script:
  swtv1_turn_on:
    sequence:
      - condition: template
        value_template: "{{ is_state('binary_sensor.SwTV1_status', 'off') }}"
      - service: rest_command.swtv1_on
      - delay: "00:00:01"
      - service: rest_command.swtv1_off
  swtv1_turn_off:
    sequence:
      - condition: template
        value_template: "{{ is_state('binary_sensor.SwTV1_status', 'on') }}"
      - service: rest_command.swtv1_on
      - delay: "00:00:01"
      - service: rest_command.swtv1_off




The deprecation of the legacy template doesn’t go into full effect for another 3 months, so it is unlikely to be the cause of button and sensors being “gone”.

There is a migration guide in the docs:

There are extensive examples and links to an automatic conversion tool in the deprecation thread…

You are absolutely right, i just didn’t see them and were not able to attach them to exisiting rooms - no unique id in switch.

Let’s cnsider that it works :wink: Yet.

But as i already started that topic, can anyone please help to improve my config to new version of configuration file?