How can I send discrete (binary) values as 0/1 via MQTT instead of opened / closed or off / on

Openhab is publishing my analog data (temperatures, etc.) nicely to my MQTT Broker but the subscribing client can’t use discrete values in the form of opened / closed or off/on - it needs 0 or 1

Although this works for analog values I would like to so something similar for Boolean sending 0/1 and can’t figure out how?

// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*

// Global Variables

// Temperature
rule "My MQTT Rules: Relay BasementTemp"
when
	Item BasementTemp changed
then
	publish("mybroker","o/ment/temperature",BasementTemp.state.toString)
	logInfo("INFO","My MQTT Rules: Relay BasementTemp completed.")

end

any similar “publish” command that would convert this text to a boolean?

Can’t you try:
publish("mybroker","o/ment/temperature", if( BasementTemp.state.toString == "OPEN") then "1" else "0"))

YES, THANK YOU!

Using your method I settled on the following:

publish(“mybroker”,“o/ment/temperature”, if( BasementTemp.state.toString == “CLOSED” then “1” else “0”))