Integer outputs on MQTT?

MQTT autodiscovery can control simple binary devices (lights, locks). Is it possible to do the same thing with a simple integer output (like a lamp brightness without the switch, ideally with an UI like an input_number), or do I need to manually hook up automations for that?

There isn’t a specific MQTT input number integration, so yeah linking an input number to publish events with an automation would be the way to go. This can be made quite simple with templates:

    platform: state
    entity_id: input_number.your_input_number
    service: mqtt.publish
    topic: "your/topic"
    payload_template: "{{ trigger_to_state.state }}"

Or you could create a custom mqtt integration: