Unknown value replace in template?

Is is possibile to replace MQTT sensor state “unknown” to other string with template ? eq to “X”

I have tried like this, but not working
value_template: '{{ value_json["temperature"] | "X" }}'

I’m using something like this for my sensor. It normally reports home. but it should report on. Perhaps you can use it

huewoonkamer:
value_template: “{% if is_state(‘device_tracker.huewoonkamer’, ‘home’) %}on{% else %}off{% endif %}”