Custom components? Is this a joke?

Hi team,

I was trying these days to create an extended version of generic thermostat.
Basically I need one that has some extra 2 buttons:

  • one button to force heater ON and
  • one button to force heater OFF
    When none of these buttons (switches) are ON, the default generic thermostat should work in place.

The issue is that I don’t like the fact I need to declare in configuration.yaml two switches(or boolean inputs) and then define couple of automation and scripts to make it somehow work, but only partially.

Then I decided I need to create a custom component to handle all this interaction, thus I start reading the source code of HA and figure out how it was build.
And I must say I’m a bit disappointed because a few issues:

  • the custom component business logic cannot be “binded” correctly to the UI in the best ergonomic common sense.
  • to have a customized UI I need to create some various UI files (html) in some other folders that are not available by default. I need to install a “development environment” to be able to create and test these.
  • even if I will succeed to create these components at the end these will be “compiled” into a couple of main html files that are almost impossible to deploy easily.
  • there is no way to actually package the entire business logic and UI functionality so it can be properly delivered and tested by testers/customers.

I am a developer so I can read easily source code of any programming language.
But what I am questioning above is the fact it is darn difficult to extend the system capabilities without touching the core.
And that makes difficult if not impossible for a person who just wants to do “implementation” to various “customers” to fulfill its purpose.
It should be much much simpler.
Even if I like the product and its nice interface, there is something wrong in the software architecture and I think it will be difficult to expand and adapt to changes easily in the future.

These are just my personal thoughts after spending ~2 weeks trying to develop something relatively easy.
I apologies if I touch someone heart-feelings but I hope my feedback will help “the team” to go into the right direction with platform architecture decisions.

Best regards,
Claudiu

I think the success of HA is because of how easy it is to extend and make custom components.
Currently there are 471 components and 316 different people have contributed to the code, but I guess it always can always be easier.

Do you know that you can put your custom component in <config dir>/custom_components/ ?
You can also set development: 1 in http:, to avoid compiling of the frontend.

Edit: You can also use the panel_custom: https://home-assistant.io/developers/frontend_creating_custom_panels/ and https://home-assistant.io/cookbook/custom_panel_using_react/

Btw, I think you can solve your initial problem with two automations, and then you do not need to change any code at all

1 Like

Why don’t you take a look at AppDaemon? It’s an add on to HA written by @aimc that may be more in line with your use case.

Hi Daniel,

Thank you for the reply, I really appreciate your effort in trying to please me.
Indeed, HA looks nice and I see it has great potential.
The case I described earlier, I manage to accomplish it somehow with automation and scripts, but it is messy and cannot be package. Not to mention that the UI is a bit cumbersome.
My point for current state of HA is that it is intended more for DYI “hackers” than real users (or even delivery people).
Perhaps there are solutions and I am looking forward to see how the process will evolve into something simpler, much simpler.

Best regards,
Claudiu

1 Like

Hi Rpitera,

I would look forward into this AppDaemon.
Maybe it would help somehow in making the customization easier.
I need to see some samples and how it works and then I will convince myself.

Best regards,
Claudiu

i think you confuse 2 things.

you have

  1. custom components which are a new switch, a new sensor, a new device_tracker, etc.
  2. customizing the UI.

the first part is what you need for your solution, and that is quite easy and you dont need to have a developer enviroment for that at all.
all you need is to create a small py script that you put in the mentioned dir.

the second part is just needed when you dont like how HA looks. if you want to change the frontend. and you already mentioned that you like the look, so you dont want to change that part.

so i think you read up on the wrong part.

like @rpitera mentioned you can use appdaemon to make your automations easy in py

1 Like

Thank you Rene,

The current state of UI interaction does not bind with some more complex use scenario, and the above one is not even a complex one. From UI point of view I could not achieve the desired look and feel (preserving current theme of course).
And having the option to group and pack the both, business logic and UI in the same package totally makes sense to me.
HA UI works (almost) equally on all platform devices so why not having this customization in place then?

Other than that, I did achieve want I wanted, just not pleased as it is not tide and neat as I would expect it.

Thank you again for pointing me the advices.
I will definitively try appdaemon.

Best regards,
Claudiu

dont expect that you can change the frontend from HA with appdaemon.
appdaemon just works on the background.

if you dont like the frontend you could checkout HAdashboard.
that is a real easy way to create a whole new frontend and manipulate that like you want.