How to scale an mqtt sensor value

Hi All,
I’ve tried a number of things to scale my sensor value so I can plug it into the energy module but to no avail. My config is as follows . . . I’ve tried various versions of code on the forums but I’m obviously missing something fairly basic I suspect.

homeassistant:
  customize_glob:
    sensor.*_energy:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement


sensor:
  - platform: mqtt
    name: SolarEdge AC Power A Energy
    state_topic: 'cbus/read/254/250/122/level'
    unit_of_measurement: 'kWh'
    state_class: 'measurement'
    device_class: 'energy'
    #value_template: "{{ states('sensor.solaredge_ac_power_a_energy' | / 1000 ) }}"

Cheers,
Paul

Hi there can you please try this for value template

value_template: "{{ value_json | float /1000 }}"

Hi, perfect many thanks. So to understand, value_json is obviously the sensor value in json format. Are we casting the /1000 as a float? Also, was there significance of not having the space between / and 1000?

Regards,
Paul