Core: Issues with zones in package

Created on 19 Mar 2020  路  20Comments  路  Source: home-assistant/core

The problem


Config fails if zones located in package.

Environment

  • Home Assistant release with the issue: 0.107.1
  • Last working Home Assistant release (if known): 0.107.0
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker
  • Integration causing this issue: zone
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/zone/

Problem-relevant configuration.yaml

configuration.yaml:

homeassistant:
  packages: !include_dir_named packages

zones.yaml:

zone:
  - name: office
    latitude: !secret work_lat
    longitude: !secret work_long
    radius: 60

  - name: parking
    latitude: !secret park_lat
    longitude: !secret park_long
    radius: 50

  - name: home
    latitude: !secret home_lat
    longitude: !secret home_long
    radius: 30

Traceback/Error logs

Package zones setup failed. Component zone cannot be merged. Expected a dict.

Additional information

Most helpful comment

I know the ticket is closed, but @balloob mentioned in the PR "Packages are a hack and it's annoying that there is no one having ownership of it. That's why things keep randomly failing." I actually quite like the way packages contribute to a clean organized config. I do not know how complex this issue is, but is there anything I could do to help "refactor" how packages work?

Maybe a short note on if it is even worth it and where to get started?

All 20 comments

Same issue!

Same issue here. Possibly related to issue #32943 which should be fixed by #32963 ?

Same issue here. Possibly related to issue #32943 which should be fixed by #32963 ?

Issue appears on 0.107.1 which includes #32963.

@bastshoes Yeah, you are totally right. ;) I put it a bit confusing. Just wanted to point in that direction.

Having the same issue in 0.107.1, unable to merge dictionary in for zone when defined in package.

Moving the packaged zone configuration into the main configuration.yaml and the problem no longer exists.

I can confirm that moving the config to the configuration.yaml fixes the issue.

using packages: a single zone defined as:

zone:
  name: School
  latitude: !secret school_latitude
  longitude: !secret school_longitude
  radius: 40
  icon: mdi:school

works fine on it's own. If any other zones are defined it doesn't work

zone:
  - name: School
    latitude: !secret school_latitude
    longitude: !secret school_longitude
    radius: 40
    icon: mdi:school

doesn't work at all in package

Seeing the same issue here. Haven't had a chance to try any fixes however.

I am seeing the same issues on my side. I had to implement the change from @pinkywafer to get just one zone to show up (my primary).

Same here. Error in config

I moved my zones line from components/packages/zone.yaml to the main config.yaml (still pointing to components/zones/) and it is working again with my 9 zones

I moved my zones line from components/packages/zone.yaml to the main config.yaml (still pointing to components/zones/) and it is working again with my 9 zones

I can confirm this method worked for me.

Running check_config after upgrade to 0.107.2.

Testing configuration at /home/homeassistant/.homeassistant
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/scripts/check_config.py", line 203, in check
    res["components"] = hass.loop.run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 104, in async_check_ha_config_file
    await merge_packages_config(
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 643, in merge_packages_config
    merge_type, _ = _identify_config_schema(component)
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 575, in _identify_config_schema
    default_value = schema(key.default())
TypeError: 'Undefined' object is not callable
Fatal error while loading config: 'Undefined' object is not callable
Failed config
  General Errors: 
    - 'Undefined' object is not callable

Successful config (partial)

Working on tracking it down...

Still not working for me either, using 0.108.0.dev20200320 as the docker for 107.2 is not available yet

Setup
configuration.yaml
homeassistant: name: HA longitude: !secret latitude latitude: !secret longitude elevation: !secret elevation unit_system: metric packages: !include_dir_named integrations
integrations/zone.yaml

zone: !include_dir_named ../entities/zones

entities/zones/work.yaml

name: work
latitude: <snip>
longitude: <snip>
radius: 100
icon: mdi:worker

Error

 ERROR (MainThread) [homeassistant.config] Invalid config for [zone]: [work] is an invalid option for [zone]. Check: zone->zone->0->work. (See ?, line ?). Please check the docs at https://www.home-assistant.io/integrations/zone

The following integrations caused the following Traceback:

discovery:

Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/scripts/check_config.py", line 203, in check
    res["components"] = hass.loop.run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 104, in async_check_ha_config_file
    await merge_packages_config(
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 643, in merge_packages_config
    merge_type, _ = _identify_config_schema(component)
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 575, in _identify_config_schema
    default_value = schema(key.default())
TypeError: 'Undefined' object is not callable

owntrack:

Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/scripts/check_config.py", line 203, in check
    res["components"] = hass.loop.run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 104, in async_check_ha_config_file
    await merge_packages_config(
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 651, in merge_packages_config
    merge_type, _ = _identify_config_schema(component)
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 583, in _identify_config_schema
    default_value = schema(key.default())
TypeError: 'dict' object is not callable

person:

Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/scripts/check_config.py", line 203, in check
    res["components"] = hass.loop.run_until_complete(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 104, in async_check_ha_config_file
    await merge_packages_config(
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 651, in merge_packages_config
    merge_type, _ = _identify_config_schema(component)
  File "/home/homeassistant/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 581, in _identify_config_schema
    print(key.default())
TypeError: 'Undefined' object is not callable

These are the ones within my configuration that fail.

I really like packages and how they work, it has enabled me to organize my configuration in a very logical manor.

Thanks for all the work on Home Assistant!

@ronytomen Issue is being addressed here: https://github.com/home-assistant/core/pull/33045

@ronytomen Issue is being addressed here: #33045

I saw, thanks!

I know the ticket is closed, but @balloob mentioned in the PR "Packages are a hack and it's annoying that there is no one having ownership of it. That's why things keep randomly failing." I actually quite like the way packages contribute to a clean organized config. I do not know how complex this issue is, but is there anything I could do to help "refactor" how packages work?

Maybe a short note on if it is even worth it and where to get started?

Likewise I'd like to know what the non-hack way of splitting up config files is if there is one.

@voydz Please create a separate thing for that, as it is not directly related to this issue.

This issue has been resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piitaya picture piitaya  路  3Comments

TheZoker picture TheZoker  路  3Comments

arangates picture arangates  路  3Comments

aweb-01 picture aweb-01  路  3Comments

bdraco picture bdraco  路  3Comments