MQTT Number Write Only

Hi there!

What I try to achieve is to retain send a number to the MQTT broker. I don’t expect any feedback. What I tried was:

- name: "Test Number 1"
  command_topic: "homeassistant/number/test1"

I am then able to add the entity to the dashboard. Unfortunately, it shows up as unmodifiable, where the value is unknown.

What do I get wrong? Can you give me a kick?

Thanks! Thomas

What I discovered is, that if I add state_topic with the same topic to the configuration and modify the topic from outside, the slider suddenly becomes available.

- name: "Test Number 1"
  command_topic: "homeassistant/number/test1"
  state_topic: "homeassistant/number/test1"

Can anyone explain that?

command_topic sends from HA to MQTT
state_topic gets data from MQTT

You need both to send data forth and back

Understood, thanks!. It’s just, I don’t want to receive any data. Just wanna send (from HA to the broker). And according to the manuals, state_topic seems to be optional.

The mqtt Number platform allows you to integrate devices that might expose configuration options through MQTT into Home Assistant as a Number.

As the documentation states, the MQTT number is really created to send data from a device to HA. You try to use it solely in HA.

Curious why the command_topic then is required but the state_topic is optional. If this is true, Francis, shouldn’t it be be the other way round?