Apop's Home Assistant Setup and Other Resources

The sensor is outputting everything it gets back from the check_config API endpoint. I believe once it hits a failure it stops there, so you’d have to correct that error and then run the check again.

That’s coming in 0.2.0. :slight_smile: Wanted to get an MVP out there for testing, but yes, I intend to make auto-restart optional. Should be pushing that update today.

Yeah, I’m not really sure how the check_config service differs from the “Check Config” button since I never use the service, only the button.

But I’m almost positive that the “Check Config” button will give you all of the errors that it finds not just the first one.

That’s not a deal breaker tho. I guess it prevents user overload from trying to figure out why 10 things have errors instead of just one. :grimacing:

I’ll be waiting on v0.2.0. I’m no MVP but hopefully my testing will count too. :wink:

:white_check_mark: Config Check 0.2.0 is now available.

  • Auto-restart can now be turned off
  • If AppDaemon cannot make a connection to Home Assistant via a token or key, sensor.config_result updates to an ERROR state.
  • Removed extra logging.
  • Added an additional Lovelace configuration example to the documentation.
  • Removed pre-release tag, though I still want a little more testing before I submit it as a default to HACS.
1 Like

Cool!

I’ve added “restart: false” to the apps.yaml in appdaemon. Now, I’m not sure what I have to do to get it initialized.

Do I need to restart Appdaemon, HA or both?

Neither! That’s one of the great things about AppDaemon, once you’ve updated apps.yaml or any of the .py files for installed apps, AppDaemon automatically sees the updates and restarts the apps that need to be restarted.

You should see something like the following in your logs when an update’s been made to an app:

1 Like

that’s even better.

I just tried it and so far it seems like it’s working as advertised.

Now I don’t have to keep jumping around and scrolling all over to test my config and restart. And once I get the lovelace card sorted out it’ll look a lot nicer to boot!

Thanks for this. It’s nice that there are users on here more receptive to fixing things like this than the devs seem to be.

I tweaked the Lovelace card a bit. I wanted the icons to be a bit smaller (& used a couple of different ones) and added a markdown card to a conditional card to display the results of the config check ion line if the result is “invalid”.

Here’s the result with an invalid config:

ex

Here is the code:

  - type: custom:vertical-stack-in-card
    title: Developer Tools
    cards:
      - type: picture-elements
        image: /local/BG-grey-card-short3.png
        elements:
          - type: image
            image: /local/icons/icons8/icons8-blue-ui-80.png
            tap_action:
              action: call-service
              service: script.check_config
            style:
              top: 50%
              left: 10%
              width: 7%
          - type: image
            image: /local/icons/icons8/icons8-restart-80.png
            tap_action:
              action: call-service
              service: homeassistant.restart
            style:
              top: 50%
              left: 26%
              width: 7%
          - type: image
            image: /local/icons/icons8/icons8-source-code-80.png
            tap_action:
              action: call-service
              service: homeassistant.reload_core_config
            style:
              top: 50%
              left: 42%
              width: 7%
          - type: image
            image: /local/icons/icons8/icons8-user-groups-80.png
            tap_action:
              action: call-service
              service: group.reload
            style:
              top: 50%
              left: 58%
              width: 7%
          - type: image
            image: /local/icons/icons8/icons8-automation-80.png
            tap_action:
              action: call-service
              service: automation.reload
            style:
              top: 50%
              left: 74%
              width: 7%
          - type: image
            image: /local/icons/icons8/icons8-property-script-80.png
            tap_action:
              action: call-service
              service: script.reload
            style:
              top: 50%
              left: 90%
              width: 7%
      - type: entities
        show_header_toggle: false
        entities:
          - sensor.config_result
      - type: conditional
        conditions:
          - entity: sensor.config_result
            state: 'invalid'
        card:
          type: 'custom:card-templater'
          card:
            type: markdown
            title: Error
            content_template: >-
              {{ states.sensor.config_result.attributes.detail }}
          entities: 
            - sensor.config_result
2 Likes

Looks awesome!

:white_check_mark: Config Check 0.3.0 Released!

  • Automatically check your configuration.yaml file any time it is updated using folder_watcher. You now can choose to use either the automatic checking setup or the Lovelace setup.
  • Sensor now changes to checking while the check is in progress. This provides better clarity around when a check is in progress, and is also more friendly to automations so that you can tell when a check has completed and send a notification, for example.
  • Documentation cleaned up and updated with new features and examples.

I’m particularly excited about the automated checking using folder_watcher. I can now save my configuration in VS Code, get a success or failure Telegram notification on my desktop seconds later, and restart Home Assistant right from Telegram. While you technically could have already set up your own automation to call script.check_config when folder_watcher saw an update to your configuration, this puts it all in one place. It also filters out duplicate folder_watcher events so it doesn’t kick off multiple config checks at once (folder_watcher seems to generate four events every time a file is modified).

As always, let me know if you have any questions or issues!

1 Like

For heaven’s sake mate just slow down. How are us mere mortals supposed to keep up? :slight_smile:

My wife and nine-month-old are out of town, so the house has gone from complete chaos to having more time than I know what to do with. :laughing: I’ve wanted to knock this out for awhile so I’m making hay while I can.

Good work, go to the pub for a while though, you deserve it :slight_smile:

1 Like

apps.yaml - do I need to create that? Do I include that as an include in configuration.yaml? Can I just add the contents of that file to configuration.yaml? Or does it need to be in a separate file?

Also tried adding the repo to HACS but error. Tried to add https://github.com/apop880/config-check

Does this require appdaemon? (not clear from Github that doesn’t even mention it)

Yes, this does require AppDaemon. Good point on the GitHub readme for the repository, I’ve corrected that oversight and just pushed a commit that calls out AppDaemon as a requirement.

I’ve also had a PR accepted for the HACS documentation with some additional documentation on using AppDaemon with HACS but I believe the updated documentation isn’t live yet.

In the meantime:

  • You’ll need to install AppDaemon. apps.yaml will be created automatically when you do so.
  • Most likely, you’re getting the error in HACS because you don’t have AppDaemon in your HACS config. You’ll need to add appdaemon: True:
hacs:
  token: !secret hacs_github
  appdaemon: True

Are the icons you use in the advanced config available anywhere?

I am not getting the result sensor created…
image

19-07-21 15:48:57.434313 INFO AppDaemon: HASS: Connected to Home Assistant 0.96.2
2019-07-21 15:48:57.714504 INFO AppDaemon: Processing restart for HASS
2019-07-21 15:48:57.714775 INFO AppDaemon: Terminating hello_world
2019-07-21 15:48:57.715004 INFO AppDaemon: Terminating check_config
2019-07-21 15:48:57.715184 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-07-21 15:48:57.716479 INFO hello_world: Hello from AppDaemon
2019-07-21 15:48:57.717621 INFO hello_world: You are now ready to run Apps!
2019-07-21 15:48:57.717733 INFO AppDaemon: Initializing app check_config using class CheckConfig from module checkconfig
2019-07-21 15:48:57.717854 WARNING AppDaemon: Unable to find module module checkconfig - check_config is not initialized

apps.yaml

---
hello_world:
  module: hello
  class: HelloWorld
check_config:
  module: checkconfig
  class: CheckConfig
  restart: false
  folder_watcher: false

scripts.yaml has:

'check_config':
  sequence: []
  alias: Check Configuration

This script is being configured as you see in Lovelace

It seems HACS hasn’t installed the module…
Actually… maybe I didn’t click install…

YEAH that was it. Working now… Would love those icons for the advanced config though…

1 Like

LOL. Why does the post have to be 10 characters? I just wanted to laugh.

2 Likes

Check out icons8.com, I use these all throughput my UI.

2 Likes

I have to laugh as well… what with installing Appdaemon and adding the repo to HACS and editing the yaml etc I didn’t know if I was coming or going and just neglected to actually click on INSTALL on the component!

Glad it amused you - it amused me as well…