Subscribe to a mqtt topic

Hello. Can I subscribe to a topic to capture data in a custom Card?
Publish and subscribe a mqtt status topic

Hi. I do not understand your answer. Maybe I explained myself wrong because I do not speak English. My question is not about programming. My question is about how to solve something in home assistant. I’m creating a personalized card and I just want to know how to take data from a tasmota device. Hass only has the service to publish but I do not know how to get an answer.
Or call a rest API and receive a json http://192.168.0.4/cm?cmnd=ap

Thank you

Thank you. What I want is to create a card to configure my sonoff with tasmota firmware. For that I want to do it with Javascript. He did not manage to capture any information from my devices. For example I want to know the information of the timers to be able to modify them
For example, if I call http://192.168.0.4/cm?cmnd=timer1 from configuration.yaml, it returns the first timer but it is 16. If I configure it, there are 16 timers for each device. I want to do something dynamic

Which Sonoff device are you using?

Why not install tasmoadmin? It has an addon for hassio, and is documented on the tasmota wiki https://github.com/arendst/Sonoff-Tasmota/wiki/TasmoAdmin

I installed it. But it does not have timer settings and it does not work like a card.

Why are you using a timer on the sonoff when you are using home assistant?

I have an aquarium and I turn on and off things at different times

The point was why are you doing the timers in the sonoff itself since you are using HA?

It would easier to have the control function processing done in the home automation system (since that is what its for) instead of doing it in the device.

Ha does not provide a visual method to configure 16 timers. I did not find another way that is. Surely I’m wrong, but that’s what I thought best