Simplistic configuration UI

You should be able to use nohup for running it from terminal/PuTTY and freeing up that shell. Something like this I would think:

nohup sudo ./configurator.py &

Doesn’t work for me. Can’t even override the SSL mismatch with Chrome and run non secure. Unless I go to it from the DDNS URL in SSL mode, this won’t run for me. With port forwarding it works great.

I’d really like to see this develop and get pulled in HA. But I think that the core devs will be focused on security and idiot proofing it from users; I think those are two of the things that have kept them away from adding this. It’s certainly been requested and the lack of it is a common criticism when I see it compared to other HA projects. (I don’t necessarily agree, but I think if that many people want something, it’s a good idea to see if it’s plausible to add.)

I think this would be at the very least an awesome add-on for HA, like AppDaemon or HADashboard is. Part of the ecosystem.

“Expand/Condense” is what you are looking for here. That’s the common terminology for that kind of behavior in a list. You can leave it fold and just use that wording in the explanation. If you like, I can work up a rewording.

Never heard of this command; it does work and I was able to close my Putty window and it still appears to be running.

But how do you close a session like that?

@rpitera
Just out of curiosity: Don’t you feel there’s a benefit in using configurator, even when it’s not embedded into HASS? Looking at myself, I’d rather click a shortcut in my browser to directly use the configurator instead of using SSH. For people doing configuration over a Samba share this indeed isn’t that big of an advantage. But now that there are the lists with available entities etc., I see an advantage (although just a little one) over using some other text editor. At the least, users wouldn’t be tied to machines where access to the share is available.
Admittedly, I’m totally biased since it’s my work. :smiley:

@dadykhoff
Thanks for that information. I have included that in the readme as an alternative. :slight_smile:
Besides there’s now also a template for using this as a systemd service. I haven’t tested it myself, but the template was reported to be working.

Yeah, nohup is a handy command line utility. It does save the output of the command in another file I believe in the directory it was executed from (nohup.out or something like that). To kill it you have to use the kill command with the PID that you can get from something like

ps -ef | grep nohup

Or

ps -ef | grep configurator.py
2 Likes

I thought I was quite clear on the benefits of it. And I wouldn’t have taken the time to test if I hadn’t. In fact I had said that this was something that I see requested often. Even suggested it become part of the ecosystem alongside AppDaemon. I’m not sure how you could mistake this for anything other than praise.

But if I can’t use it in an SSL environment, then it isn’t as useful for me. The only time I would access this is if I needed to change a configuration from another location. Otherwise, I would use the tools with which I am the most comfortable and have the most experience with.

You were clear. I guess it’s more like a lack of confidence regarding my work on my side.

Anyways, I’ve pushed new code. You can now set credentials at the top in the form of "username:password" and use basic HTTP authentication. With that it should be acceptable to do the port forwarding. There is however no mechanism detecting brute force attacks, so the password should be a rather tough one.
Even though basic authentication allows to include the credentials in the URI, I would suggest to not do that with the panel_iframe. I’m pretty sure the credentials would end up in HTML of the HASS frontend in plaintext. So having to enter the credentials would be the way to go in my opinion.

Additionally, if you now select some element from one of the lists on the left side, the inserted text is selected automatically. Would that be enough to give a visual indicator of what happened?

2 Likes

Good, because I would hate for you to feel discouraged in any way. In fact, once you feel this is ready for release I plan on telling some reddit users about it the next time the bring up that “Oh, HA is nice but there’s no way to edit files in the web interface…” garbage!

I think what you have created here is an awesome add on to HA and you shouldn’t feel at all insecure about it. I envy the skills of real coders like yourself.

I’ll give a try at the new features tomorrow when I have a bit more time to dedicate to it and I’ll get back to you. I appreciate you looking into my use case and added the authentication. I think it’s going to give it an even wider appeal. And ultimately that is what I’d like to see for your project; that’s why I gave the suggestions I did.

I think that’s a great idea, man. Thanks for taking the suggestion to heart and implementing it so quickly.

Great work!

3 Likes

Thanks for the kind words. Much appreciated. :slight_smile:

Looking forward to your testresults.

Update:
There was a bug where authentication did not work with SSL. Silly me. It’s fixed now.

Additionally 3 nifty features have been added:

  1. Allowed networks feature (like in HASS)
  2. Banned IPs (don’t know if HASS has that as well)
  3. Ban IPs after n failed login attempts

Have a look at the README in the repo for more details.

Great - looking interesting!

BTW, HASS does have HTTP black/whitelists and bans … see https://home-assistant.io/components/http/

Not sure if you can leverage or want to remain standalone.

Also - have you thought about generating yaml in a new, temporary file rather than the live file, which then could be validated before committing it to “prod”.

I guess that would require a change to the hass script to check config … or you would make a backup of the yaml that you could rollback if you don’t like your changes from the tool.

Yes, that HASS internal security features would indeed take care of such security features (and also some other settings like SSL for that matter). But I have no experience with HASS frontend development, so making this a stadalone service was the way to go to get this done quickly. After a while I came to the conclusion: not being directly integrated into HASS is a good thing, since this service will keep running even if HASS fials to start because of a faulty config.

And yes, I’ve thought of some HASS API improvements before myself. However, those improvements only have value with a specific use case. So as long as this isn’t popular enough or alternatives are available, nobody would take time to implement it.

What I’ve thought of so far:

  • Voluptuous API to validate config snippets for platforms / components
  • check_config API (like you suggested as well)
  • Fail-safe mode for HASS where it woudn’t restart if check_config fails
  • Components / platforms should register their possible events + events.yaml (like services.yaml), since currently the list of availble events does not include every event that can happen

All those would be obsolete without something leveraging those API calls. So here I’m creating something that would use them. :slight_smile:

1 Like

Being implemented in Check config before restarting by andrey-git · Pull Request #5609 · home-assistant/core · GitHub

True. For that I’ve even opend up a feature request here a few days ago, but nobody’s voting. Which is why I came to believe the configurator needs more popularity before it makes sense to implement the more useful features.
Admittedly, the way I proposed it is a little different from the implementation in the PR though.

Voting isn’t working on that post for some reason. I tried reclassifying it to another category, saving it and then setting it back to Feature Request but it still isn’t allowing for voting.

Not sure what the issue is.

Edit: It appears that I was able to fix it and I gave it a vote. So maybe you can instruct folks to try again.

Thanks for your effort. But since it’s being implemented already, I kind of see it already as accepted, and will mark it as solved as soon as it makes its way into a stable HASS build. :slight_smile:

1 Like

Really like what your doing !
A bit off-topic:
I do use the github approach for updating my config. So for me it is not a solution. But the idea is great and I’ve been thinking about your approach to be implemented as a plugin in one of the currently popular text editors (Atom, Brackets, VS code)… Just an idea I’d like to share…

1 Like

To keep you guys updated:
I’ve kept working on this. There were issues when combining SSL setups with running this as a service (or from annother path). Those now should be resolved.
Besides that I have replaced two of the toggle buttons in the toolbar. One is linking to the keyboard shortcuts of the editor, and the other one allows you to change pretty much any setting of the editor. You can even switch to a vim or emacs emulation (sublime doesn’t work). How cool is that? :slight_smile:
Oh, and now you’re asked to confirm before the file is being saved. Just to be safe.

5 Likes

Nice work man! Shoot; I’m going to have to read back a few and get back up to speed so I can run this again.

This is really becoming a super add on to HA!!

Absolutely amazing work @danielperna84! I gave it a fresh coat of paint to blend with HA as well as made it a little more responsive for mobile editing (everything collapses into a side nav). However I have somewhat broken the new Ace editor menu :disappointed:

Thanks for sharing this!

6 Likes