danielperna84 / hass-configurator

Configuration UI for Home Assistant
MIT License
315 stars 168 forks source link

Enhancement suggestions #139

Closed GaryOkie closed 5 years ago

GaryOkie commented 5 years ago

1) After reading up on the ACE editor shortcuts I discovered a big timesaver - toggling of comments ! It would be a nice feature to include a new editor icon "#" that would run CTRL-/ for a selected block of text to comment or uncomment code for users completely unaware that shortcuts like this exist.

2) The tool to indent and outdent are not very useful for YAML since it is coded for +/- 4 spaces. I see from the docs that it is possible to configure the code, but for HASSIO users this isn't entirely practical, is it? Can the Indent/Outdent be changed to 2 spaces or at least please document how HASSIO users can change this.

3) The ability to insert entities selected from the left frame is very useful but it would nice if once they are inserted that the inserted entity is not highlighted, since after an insert, if you then press enter, the text is removed. (yeah, you just have to remember to clear the highlight, so no big deal other than being a constant annoyance to have to reinsert it).

4) And maybe it's just me, but I think that displaying entities sorted by their normal HA name, not the friendly name, would make it easier to work with when needing to add them to the configs since they are grouped naturally that way.

5) I sure wish the editor could run in the same docker, using the same port/authentication, etc, as HA so that it can be properly integrated when running in SSL mode - unless there is some other clean way to accomplish this. Port forwarding to 3218, separate credentials, etc., should be avoided.

danielperna84 commented 5 years ago
  1. A #-shortcut in the fab-menu (the pencil icon in the lower right) seems acceptable to me.
  2. If you click on the 3-dot-button in the top right, you'll see the "Editor settings". There you can set your own tab-size. Once you click "Save settings locally" at the bottom, that should be the default for that browser. I do agree though, that a default value of 2 might make sense. But maybe this can be done dynamically as well. So if a yaml-files is opened set to 2, otherwise go back to 4.
  3. If I remember correctly that's on purpose to allow quickly undoing if the wrong entity has been selected. It's just one keystroke on the keyboard to de-select. Selecting on the other hand requires multiple keystrokes (CTRL+Shift+ 3 times to the left). Also it allows you to directly copy the entity id to the clipboard in case you need it more than once for the current change you're doing.
  4. I have to disagree on this one. Some components create entity IDs like sensor.ahd93weshrf3w. If you have 20 of those you don't know which one is which, and most likely you have given them useful friendly names. On top of that, the friendly names are what you mostly see in the UI, hence you don't have to lookup when you want to target a specific entity. Besides all that: since I have added the search function I think I have never again used the regular entity-list. I have >100 entities in that list. To find the entity I'm searching by scrolling through the list would be very cumbersome. Especially with as lot of entities that have cryptic names.
  5. That's specific to hassio. But I believe this is being added manually in this PR: https://github.com/home-assistant/hassio-addons/pull/448 Maybe an "Any news on this"-post (from somebody else than me) would motivate Pascal to finish things up. 😉

And of course thanks for all those suggestions. 🙂

GaryOkie commented 5 years ago

Wow - the "3 dot icon" was a pleasant surprise! All this time, I've completely overlooked it. That's great we can change the tab settings appropriate for YAML. I did read the docs, even studied up on ACE, but never saw this built-in configuration capability mentioned.

I agree with you that having the friendly name displayed in the left frame entity selection is very important. I just don't find that sorting the list by the friendly name very helpful.

Thanks very much for listening!

danielperna84 commented 5 years ago

I just don't find that sorting the list by the friendly name very helpful.

I guess that's just a personal preference. To me, sorting by entity ID wouldn't be intuitive when searching a particular named device. And since in all the time this request has not been posted I think this should not be changed. After all the search utility should be the tool of choice.

GaryOkie commented 5 years ago

If you are just cherry picking specific entities to insert, then sure - the current list is perfectly fine as-is.

However, a very common use-case is inserting groups of common entities for display groups, lovelace cards, automations, etc. I've resorted to using the "<>" states list to copy/paste into Excel to get a group of like-entities. I also just learned how to do this by adding a small bit of Perl code to the developer template.

Both methods are a bit awkward, so that's what led to my enhancement request to be able to sort by entity name to make these bulk insertions easier without having to hunt for them by name one by one.

danielperna84 commented 5 years ago

I'm sorry, but I don't think I can be convinced to change this. Even if for some users that might be the better implementation, lot's of users are used to the current way it is, and will start complaining if this changes. So the only chance of this happening would be an option to actively opt-in to change the sorting.

But even with you example that doesn't seem like an ideal solution to me. When I add multiple entities, I still want to pick specific ones, not all of them. And if I would want to add an entire domain, I'd use a template like this to get it in exactly the correct format - which also depends on where you want to add it in the yaml.

For example, this template gives me all device trackers ready to copy and paste as entities for a trigger:

{% for state in states.device_tracker -%}
{{ state.entity_id }},
{%- endfor %}

By using that I wouldn't have to click every entity and add ,'s for every entity. In the worst case I would have to delete some entities. Which is still a lot less work than clicking until my fingers bleed. And I'm pretty sure that users that have spent some time with Home Assistant are aware of such workarounds that save a lot of time. Sure, the configurator's purpose is making HASS easier to configure. But I don't see a benefit in adding something like this when HASS itself ships a tool that's made for exactly such tasks.

I did have a look at the code to see how sorting is done. Essentially it's really just sorting alphabetically by the content of the option of the select element. Currently the content is created as option.text = states_list[i].attributes.friendly_name + ' (' + states_list[i].entity_id + ')';, which you can see here. So it would be easy to flip those two values to display the ID first with the friendly name in brackets -> option.text = states_list[i].entity_id + ' (' + states_list[i].attributes.friendly_name + ')';. But would you really keep on clicking a bunch of entities when a template gives you something you can easily copy and paste?

GaryOkie commented 5 years ago

I agree Daniel. I only just learned of that little Perl template today and it does indeed provide a much easier way to copy a block of common entities. This is what I will be using from now on.

Having a configurable entity extractor built into the developer tools (or configurator) to facilitate bulk/group editing would be the ideal enhancement.

An option to toggle the sorting of the listing in the configurator would also be kinda nice (if easy to do), but I definitely agree that having to individually click on each one to insert it would be a bit clumsy, even if they were all grouped together in the list nicely.

danielperna84 commented 5 years ago

An option to toggle the sorting of the listing in the configurator would also be kinda nice (if easy to do)

It would be easy, but I don't know where that could be placed. As you know first hand, mostly nobody looks into the menu on the top right (I just changed the icon to a gear icon to make people curious with the next release). And next to the list element there's ne space left, or the available space is more useful when used by content than a button to change the display order. It's hard sneaking such features in without distracting the existing userbase while telling them the feature is available.

GaryOkie commented 5 years ago

Good thinking - simply changing the dots to a gear. That really should make it more noticeable. 👍

I rescind my enhancement request # 4 since it doesn't make bulk copying/insertion of common entities much easier.

When you said "HASS itself ships a tool that's made for exactly such tasks", are you referring to the developer template, and the ability to input a bit of Perl code into it to execute? Again, I'm fine with doing that from now on, but it's not as straightforward (especially for noobs) as having this as a built in capability.

I'll look to see if there is a way I can change the default set of example commands in the developer tool to include a new link to run that bit of Perl code. That would be much more useful than telling me the temperature is 25C and Paulus is at unknown! :)

But if something like this were built into the configurator instead, a suggestion would be to leave the current "entities by friendly name" display as is, but add a new drop down section that would list all entities sorted by their name alone in a flat list that could easily be copy/pasted in blocks.

danielperna84 commented 5 years ago

When you said "HASS itself ships a tool that's made for exactly such tasks", are you referring to the developer template, and the ability to input a bit of Perl code into it to execute?

Yes, that's the panel I mean. And even though it could make sense in the configurator, it would be duplicate functionality, and on top of that would be tricke to implement. The panel in HASS has direct access to everything. The configurator has to go through the API, be authenticated etc.. That's just not worth the effort for a tool that already exists. Besides that: it's not Perl, it's the Jinja2 templating language. 😉

I'll look to see if there is a way I can change the default set of example commands in the developer tool

I don't think that's possible. But the default does give a good overview of what's possible. And after all you probably always do something completely different when using the tool, so it shouldn't really matter.

To sum this up:

  1. This is now available in the devel branch.
  2. The devel branch has the new icon, so people should be more ware of the setting for this.
  3. Won't change that.
  4. We discussed about that, so that won't change either.
  5. That's not directly related to the cofigurator, and it's being worked on in the addons repository.

Did I forget anything?

GaryOkie commented 5 years ago

My apologies for not responding sooner and not finding time to test your devel branch code (something I've not done before). However, I'm sure looking forward to your upcoming 0.3.4 update!

It's not entirely clear to me what the new option hass_ws_api is for, but taken in the context of the #448 discussion, I assume that by specifying my external hassio duckdns URL that the configurator will be accessible directly by Hassio via SSL without having an additional port forward.

Thanks very much for all your efforts in improving this great tool!

danielperna84 commented 5 years ago

The standalone variant is already available if you want to give it a try. When the hassio-variant will be released depends on Pascal, who apparently has other priorities currently.

It's not entirely clear to me what the new option hass_ws_api is for, but taken in the context of the #448 discussion, I assume that by specifying my external hassio duckdns URL that the configurator will be accessible directly by Hassio via SSL without having an additional port forward.

No, it's just to prefill the text-box in the event observer section. Its used to get a live stream of events happening in Home Assistant. By default the configurator tries to guess what the correct URL could be. But for people who use SSL and expose to the web, this address can't be guessed automatically. So with this option it can manualle be set so you don't have to enter it every time you want to use the tool.

GaryOkie commented 5 years ago

Hi @danielperna84 - just updated the hassio-variant configurator to 3.0 which just now became available. Nice! All the new features we discussed back in January are finally available.

I am especially liking the ability to run it within an SSL encrypted Home Assistant via this new "ingress" thing - either by the "Open Web UI" link, or a Panel_iframe link on the main page. This is what I have set up that works nicely...


panel_iframe:
  config_editor:
    title: 'ConfigEditor'
    url: 'https://xxxxxxxx.duckdns.org:8123/hassio/ingress/core_configurator/'
    require_admin: true
    icon: mdi:file-document-edit-outline

EDIT: Retraction to the above... it worked for a day, then it would only display a hassio home page within another. I did find from a post from balloob how to do this now.