{"action":"created","issue":{"url":"https://api.github.com/repos/balloob/home-assistant/issues/1714","repository_url":"https://api.github.com/repos/balloob/home-assistant","labels_url":"https://api.github.com/repos/balloob/home-assistant/issues/1714/labels{/name}","comments_url":"https://api.github.com/repos/balloob/home-assistant/issues/1714/comments","events_url":"https://api.github.com/repos/balloob/home-assistant/issues/1714/events","html_url":"https://github.com/balloob/home-assistant/issues/1714","id":146042000,"number":1714,"title":"We should detect duplicate keys when loading configuration.yaml","user":{"login":"jaharkes","id":394722,"avatar_url":"https://avatars.githubusercontent.com/u/394722?v=3","gravatar_id":"","url":"https://api.github.com/users/jaharkes","html_url":"https://github.com/jaharkes","followers_url":"https://api.github.com/users/jaharkes/followers","following_url":"https://api.github.com/users/jaharkes/following{/other_user}","gists_url":"https://api.github.com/users/jaharkes/gists{/gist_id}","starred_url":"https://api.github.com/users/jaharkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaharkes/subscriptions","organizations_url":"https://api.github.com/users/jaharkes/orgs","repos_url":"https://api.github.com/users/jaharkes/repos","events_url":"https://api.github.com/users/jaharkes/events{/privacy}","received_events_url":"https://api.github.com/users/jaharkes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-05T16:31:13Z","updated_at":"2016-04-06T01:52:35Z","closed_at":null,"body":"**Home Assistant release (`hass --version`):**\r\n\r\n\r\n**Python release (`python3 --version`):**\r\n\r\n\r\n**Component/platform:**\r\n`homeassistant/util/yaml.py`\r\n\r\n**Description of problem:**\r\nyaml parser accepts duplicate keys. So when someone forgets to add '-' to a list of mapping type entries there may be no error message or the error is confusing.\r\n\r\nOn gitter.im I noticed a message from @frelev who had an automation that didn't load correctly (see below configuration sample). The error message was quite unhelpful,\r\n    \": extra keys not allowed @ data['condition'][0]['weekday'].\"\r\n\r\nThe reason we get this error message is because the second `platform: state` entry overwrite `platform: time` and the config validation for a state automation does not expect or accept a weekday entry. I can easily imagine two independent `platform:state` conditions that would be silently accepted, but not work correctly.\r\n\r\n**Expected:**\r\nA duplicate key in a configuration file should trigger a load/parse error. But we cannot make the OrderedDict write-once for items so we probably need to introduce a proxy-object while loading the configuration that can catch whenever an existing key is about to be overwritten.\r\n\r\n**Problem-relevant `configuration.yaml` entries and steps to reproduce:**\r\n```yaml\r\nalias: Turn on bathroom player weekdays\r\ntrigger:\r\n  platform: time\r\n  after: '16:15'\r\ncondition:\r\n  platform: time\r\n  weekday:\r\n    - mon\r\n    - tue\r\n    - wed\r\n    - thu\r\n    - fri\r\n  platform: state\r\n  entity_id: media_player.toalett\r\n  state: 'off'\r\naction:\r\n  service: media_player.media_play\r\n  entity_id: media_player.toalett\r\n```\r\n\r\n**Traceback (if applicable):**\r\n```bash\r\n\r\n```\r\n\r\n**Additional info:**\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/balloob/home-assistant/issues/comments/206069994","html_url":"https://github.com/balloob/home-assistant/issues/1714#issuecomment-206069994","issue_url":"https://api.github.com/repos/balloob/home-assistant/issues/1714","id":206069994,"user":{"login":"balloob","id":1444314,"avatar_url":"https://avatars.githubusercontent.com/u/1444314?v=3","gravatar_id":"","url":"https://api.github.com/users/balloob","html_url":"https://github.com/balloob","followers_url":"https://api.github.com/users/balloob/followers","following_url":"https://api.github.com/users/balloob/following{/other_user}","gists_url":"https://api.github.com/users/balloob/gists{/gist_id}","starred_url":"https://api.github.com/users/balloob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balloob/subscriptions","organizations_url":"https://api.github.com/users/balloob/orgs","repos_url":"https://api.github.com/users/balloob/repos","events_url":"https://api.github.com/users/balloob/events{/privacy}","received_events_url":"https://api.github.com/users/balloob/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T01:52:35Z","updated_at":"2016-04-06T01:52:35Z","body":"The group one was broken because at that time I did not understand voluptuous too well: https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/group.py#L51\r\n\r\nI guess that can be replaced with a simple dict validator."}}