Set mqtt device to a special value

I have a mqtt device heating something, I am able to switch heat on/off and can get the temparature. All confiurated in configuration.yaml. But I like to set the target temperature too.
I know there are number: and input_number: and so the sample but do not understand how to combine this with my mqtt device. In other words how to send this target, meaning hwo to write this in configuration to yaml. I have no problem on the device site.
Tahnks for any hint or a sample script

Please check out generic thermostat, it has the same function.

Sorry that does not match. All of this is done by the device, it has it own Display and input posibilitiy. With hass I only want to have an additional remote control. So the what I need is.
get the actual temperatur - works
get the actual state of heater - works
start stop heating - works (the stable temperature ist only needed for some hours, so that interval has to be started on possibly stopped before end of configured time)
get the time passed - works
set target temperature - ? how
set start time - ? how (the device has the actual time from my time local server)
set working time - ? how
just need on sample how to send (publish) a number to the device via mqtt

Tanks

If you want to publish a value to a topic, you can use the mqtt.publish service.

  • Create an input_number representing the desired target temperature.
  • Create an automation with a State Trigger that monitors the input_number’s value.
  • When the value changes, the automation is triggered and publishes the value to the topic that represents the target temperature.

The same principle applies for setting the start time. Let me know if you need help creating the automations.

It would look similar to this:

alias: 'example 1'
trigger:
  - platform: state
    entity_id: input_number.whatever
action:
  - service: mqtt.publish
    data:
      topic: your/target_temperature
      payload_template: "{{ trigger.to_state.state}}"

Thank you that should help

Sorry I was too quick, I do not need an automation, I have a lot of working automations for other thing. I just need a possibility manual remote parameter setting of my ESP8266 device which works stand alone very well. Remote reading state an temperature works via sensor: remote starts stop works via switch:
Missing is setting operational parameters

Tahnks

My apologies but I don’t understand what you are trying to do. Hopefully someone else does and will help you. Good luck.

OK again, I have a device ESP8266 controlled, thats heating a box at a confurable daytime for a configurabel time in minutes to e confiruable temperature. It has ist own input elements and display for outp. It works fine for himself. It is connected to my WLAN. It my be configured alternativly via mqtt and ist state on/off heating temperature settings are send periodicly to an mqtt broker.
I like to integrade it into my hass.
I succeeded to show state (on/of and heat on/ooff) and the temperatures to be shown in hass screen. I even succeded in switchin on/off. But I do not know how to set the target temperature, the starting time and the length. For that I need an input filed in the hass gui and and ok button to publish the values.
As I know till now that should be able with a nuber or input_number section in configuration.yaml. But the samples does not show how to to this via mqtt publish. There should nothing be automated via hass, just setting target values on my device.

Thanks for any help or sample script

That’s exactly what the automation I posted does. When the value of the input_number is changed, the new value is published to the MQTT topic.

If you create an input_number and want its value to be published to an MQTT topic, you must use an automation to do that.