Get date time value inside custom component

Hi, I develop a custom component for my smart thermostat. I need to get and set the value of a input datetime sensor inside the custom component code. How can I do??


You’ll need to call the input_datetime.set_datetime service with

Thanks I will try it

Hi try but I don’t understand how can I call services with python custom component. Please can you write me an example?
Thank you

I have never written a custom component, I just found this on the fourms, try Google.

Did you find a way to do it … If so, could you give me an example?

Thank you,

Did nothing come up related in a google?

I have done hours of research and pretty hard to find anything … Your topic is basically what I’m trying to do!

If you know an Home Assistant genuine component that do such thing, I’ll get a look! Or better, if you managed to solve your initial problem, it would be great if you could share your Git / code…


Wait, what are you trying to do? Is it custom-component related or not?

Yes… it is custom component related!

Within a binary sensor, in my custom component, through its attributes, I present some related information that I wish the user could edit…


In this view, it would be great if the user could click on Begins and Runs times and adjust them!

Again, if you have any examples/Git links that shows something like that, do not hesitate to share!



That isn’t possible from the frontend.

Ok for this one … But any idea if we can create these input_datetime “entities” automatically when mounting our custom component?


I manually created these entries in my configuration.yaml file. It would be great if I could generate these entries with my custom component and interact with my code variables…

Check the input_number source code and see if you can make an file, probably.

I know this is an old post but did you work out how to create time entities from the custom_component?
Or at least be able to interact with user created ones?

I never managed to figure out how to make this work in a custom component!

I explored a lot of integrations, but couldn’t find any that made such an input!

Saw a few to explore while on vacation…whenever I have a moment I’ll check them out. If you find how to get there, please share! Thanks.

If I find out before I’ll share as well!