Another option is something like this:
template:
- trigger:
- platform: state
entity_id: sensor.some_sensor
sensor:
- name: "Some new sensor"
icon: ...
unit_of_measurement: ...
device_class: ...
state: "{{ trigger.to_state.state if trigger.to_state.state | has_value else trigger.from_state.state }}"