Simplistic configuration UI

Awesome, thank you. It’s all working now!

I want to run configurator all the time, even if I reboot my RPi3 it should run when system starts. Does systemd work like that or does it only keep the process running once it was started manually?

Systemd should start the process as soon as your PI has finished booting. So in theory you should be good to go now. :slight_smile:

Great! I just need a little more help with systemd.

I have to edit your template file with my basepath - so the same path as in mysettings.conf.

My hass-poc-configurator.systemd looks like this then (is that correct)?:

[Unit]
Description=HASS-PoC-Configurator
After=network.target

[Service]
Type=simple
#Set the path to your configurator.py location
ExecStart=/usr/bin/python3 /home/hass/.homeassistant/configurator.py

[Install]
WantedBy=multi-user.target

I’ve been going through HASS systemd documentation, but I don’t fully understand it. Now that I edited your file I have to put it there - /etc/systemd/system/ - and that’s it? How will it know to read mysettings.conf?

Just append the path to the end of the line where it says configurator.py. Just as if you were exciting the configurator manually. Use the full path tough.

I created a Dockerfile for this for myself:

https://hub.docker.com/r/tboyce021/hass-configurator

Just mount your configuration files wherever you want (I used /data). The settings.conf file will be in /config, so you’ll want to mount a volume there to persist it. Edit that file to the appropriate settings and you’re done. I plan on making some changes to clean up the Dockerfile a bit and potentially grap all the settings from environment variables, but it’s working for now.

I need some advice on ways to go about setting this up. I’d like it to be accessible only from within Home Assistant and without a password (just the HASS password). I’m using Traefik as a reverse proxy and everything is running under SSL (from LetsEncrypt), so in order for the iframe to work the configurator also has to use SSL. Is it possible to do this with a trusted certificate so there’s no security warning, without having to install custom certs on every machine I use?

I’m currently using config.domain.com to get a cert from LetsEncrypt and pointing the iframe to https://config.domain.com, but that means it’s accessible from the web and I have to add a password to protect it.

If that’s not possible, how much of the functionality is in the Python code? My alternative idea was to strip it down to just the HTML/JS and load it as a custom panel, but I’m not sure how much I’d lose by doing that (I’d be alright with just the basic browse/edit/save functionality) and I’d rather not go that route if I don’t have to.

If I get you correctly, then what you’re planning to do won’t work out well. You have to see the configurator as an entirely isolated application. Porting it to become a custom panel would be the only way I can see this work out. But there is quite a bit happening in the backend. That’s why I went this route in the first place. It may not be that hard though to modify HASS to provide the same backend functionality, with git integration being an exception (it would require HASS to use an additional dependency). In some places it may even make the configurator more flexible and streamlined, leaving away the requirement of defining the HASS API endpoint etc…

Anyways, sooner or later HASS will bring its own configuration UI, and instead of trying to port the configurator I’d rather recommend to put effort into the internal one. They’ve started with the groups already. So I personally see my configurator as a temporary workaround as long as there is no better solution available. So if you have time to spare, I’d invest it in improving HASS’ own configuration UI, maybe using my configurator as a rough guide.

Hey thanks for sharing.
I started looking at it but it got lost amongst other things.
Your approach is what I expected to use. One other way I saw to achieve this was to have a dockerfile based on a linux image that calls git clone on the original repo. e.g. https://github.com/james-fry/dasher-docker/blob/master/Dockerfile
I assume that the alpine python base image is a more efficient way to go…

I’d like to see them use yours as a base and just remove some of the duplicated functions. As an editor (especially with your shortcuts and pick lists) I think it would make a great drop in addition to the configuration suite.

1 Like

The problem I see with using my work as a base is, that I’m using pretty much vanilla JavaScript and some jQuery for when I’m to lazy to do it manually. HASS on the other hand uses this polymer-thing, which to me seems like a bunch of abstraction-layers to make development more easy. But being it’s own framework, I don’t know anything about it, and getting started and becoming efficient at it would take me more time than I have to spare. So that task should be taken care of by someone who’s familiar with how the frontend works.
For such a person it shouldn’t be that difficult though. At the basic level the configurator just has a REST API that delivers files / folders upon request and displays the content in the Ace Editor. All the entities, services etc. are already available via API (that’s where I get them from), so only those widgets would be missing. Essentially: Someone who knows how to build the current dev/services/templates pages HASS already has could get this done in a day since all that security-related stuff becomes irrelevant, and I assume because of the framework everything looks nice right out of the box. :smiley:

1 Like

Tbh, I can only speak for myself, but I really prefer it that way. It makes it easier to set up permissions so only a single computer on my lan is able able to access something like that. I wouldn’t dare to use it otherwise.

Thanks for taking the time to explain; I respect your position.

And either way, I can still use this! :wink:

@tboyce1 & @hijinx
Since you have already started with the Docker topic, could you have a look at Hass.io - Add-on ideas? I’ve never worked with docker, but maybe one of your forks could provide what is needed to make the configurator a compatible hass.io add-on.

1 Like

I think that @tboyce1 already has:
https://hub.docker.com/r/tboyce021/hass-configurator

based on the dev guideline:
Under the hood, add-ons are Docker images published in Docker hub. Developers can create GitHub repositories that contain multiple references to add-ons for easy sharing with the community.

1 Like

Thanks for the great work!
I have issues editing files on Android (in Chrome at least). When typing, the new text overwrites the old text instead of adding to it. Anyone else having this issue?

Thanks! :slight_smile:
Did you see the settings menu? There’s a checkbox where you can enable and disable “overwrite” mode. Maybe you’ve unintentionally ticked the box.

It seems that the problem is the Switkey keyboard! Using the Google Keyboard works correctly. I guess it has something to do with autocorrect. Is it possible to disable auto correct on that field?

I guess that depends on the keyboard. The configuration is nothing more than an editor within a website. So you have to look at the possibilities your keyboard provides. Or maybe the browser you are using has an option to disable autocorrect.

Text inputs on websites can specify if the keyboard should do autocomplete. Check this: https://weblog.west-wind.com/posts/2015/jun/15/turn-off-html-input-auto-fixups-for-mobile-devices

Thanks. Didn’t know about that. However, I probably can’t to that. All I have is a div on which the Ace Editor is applied. So this probably has to be implemented for the Ace Editor itself. Here’s the repository where you may open an issue about that: https://github.com/ajaxorg/ace