How to transfer Switch State by MQTT to Losant broker?

I created a dashboard, made some widgets and tied them to attributes, I successfully managed to transfer the data to the broker losant MQTT, using MQTT explorer. But I don’t understand how to transfer the value of the slider or switch using MQTT. Where is the data about the status of the switch, slider? How to dispose of them. What do I need to read to better understand?

Hi @Otis_Travis and welcome to the Losant Forums!

I’m a little unclear on what you are trying to do. Is “the value of the slider of the switch” referring to our Input Controls Block? If so, our documentation lays out how to set the state of those components using the last recorded value from a device.

If you are referring to other issues you are experiencing, can you please provide more details, including screenshots, what you have tried so far, and what you are expecting?

Thanks and again, welcome to Losant!

Thank you for your answer. I have read the documentation. Understood in many aspects. I was able to form my question.

  1. Can I transmit data with “Input Controls” without using the “Trigger Button”? For example: data will be transferred using MQTT when the switch or slider will be changed. Can I do this with workflow and how?
  2. Also for some reason Input Controls are updated only when the page is updated, but monitoring widgets are updated correctly once at the appointed time. Why is that so?
  1. Can I transmit data with “Input Controls” without using the “Trigger Button”? For example: data will be transferred using MQTT when the switch or slider will be changed. Can I do this with workflow and how?

No, you must press the trigger button to submit the current values of all input controls, either to a workflow (Virtual Button) or a device command.

In your case you want the first option - to submit those values as a Virtual Button press. You can then take that payload and use it to record device state; send an outbound MQTT message; and more.

Also for some reason Input Controls are updated only when the page is updated, but monitoring widgets are updated correctly once at the appointed time. Why is that so?

I’m guessing the block is unlocked, during which time we do not update the dynamic values of input controls.