Tasmota flashed Window Sensor ON/OFF to true/false? MQTT

Just create an MQTT Device and add a ‘Turned On/Off’ capability pointing to the correct state & command topics of your tasmota device.

Then you have two options to solve your problem:

  1. Either configure the input and output templates like this:
    input: value == ‘on’
    output: value ? ‘on’ : ‘off’

  2. Or leave the input & output templates empty. After creating the device, go to the advanced device config and select ‘on/off’ for the ‘on/off values’ setting (true/false in screenshot), this will automatically convert boolean values to ‘on’ & ‘off’ in both directions.

Marh.js expression examples can be found here:
https://mathjs.org/

You can use ‘path.to.property’ I stead of ‘value’ within the templates, if the input is a JSON formatted message.