diff --git a/.gitignore b/.gitignore index 894a44c..9707bec 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,66 @@ venv.bak/ # mypy .mypy_cache/ + +# ############################# +# JetBrain +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests diff --git a/LICENSE b/LICENSE index 38e4d99..96f1555 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,4 @@ -MIT License - -Copyright (c) 2018 eyesoft +Copyright (c) 2018 The Python Packaging Authority Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 115874e..e6d2422 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,15 @@ -# home-assistant-custom-components -Custom components for Home Assistant (https://www.home-assistant.io/) +# Min Renovasjon -#### Min Renovasjon: +[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg)](https://github.com/hacs/integration) + +Home Assistant integration of the norwegian Min Renovasjon app. + +## Installation +Under HACS -> Integrations, add custom repository "https://github.com/eyesoft/home_assistant_min_renovasjon/" with Category "Integration". Select the newly added integration named "Min renovasjon" and install it. + +## Configuration + +To enable the use of Min Renovasjon in your installation, add the following to your configuration.yaml file: ``` min_renovasjon: @@ -10,36 +18,37 @@ min_renovasjon: street_code: "12345" county_id: "1234" date_format: "None" +``` -sensor: - - platform: min_renovasjon - fraction_id: - - 1 - - 2 - - 3 - - 19 - ``` - -**street_name:**\ -The name of the street without house number, e.g. "Slottsplassen". ++ **street_name** _(string) (Requred)_: The name of the street without house number, e.g. "Slottsplassen". ++ **house_no** _(string) (Requred)_: The number of the house, e.g. "1". ++ **street_code** _(string) (Requred)_: Can be found with REST-API call. ++ **county_id** _(string) (Requred)_: Can be found with REST-API call. ++ **date_format** _(string) (Requred)_: Defaults to "%d/%m/%Y" if not specified. If set to "None" no formatting of the date is performed. -**house_no:** \ -The number of the house, e.g. "1". +#### REST-API call to fetch street_code and county_id: -**street_code:** \ -**county_id:** \ -Can be found with this REST-API call. ``` https://ws.geonorge.no/adresser/v1/#/default/get_sok https://ws.geonorge.no/adresser/v1/sok?sok=Min%20Gate%2012 ``` "street_code" equals to "adressekode" and "county_id" equals to "kommunenummer". -**date_format:** \ -Defaults to "%d/%m/%Y" if not specified. If set to "None" no formatting of the date is performed. +#### Fraction sensors + +One sensor will be added for each fraction specified in your configuration.yaml file. + +``` +sensor: + - platform: min_renovasjon + fraction_id: + - 1 + - 2 + - 3 + - 19 +``` -**fraction_id:**\ -One or more fractions for which a sensor is to be set up. ID's might be different depending on county. Turn on debug logging in Home Asstistant to log the list of fractions +**fraction_id** _(int)(Required)_: One or more fractions for which a sensor is to be set up. ID's might be different depending on county. Turn on debug logging in Home Asstistant to log the list of fractions (https://www.home-assistant.io/components/logger/). ``` 1: Restavfall diff --git a/min_renovasjon/__init__.py b/custom_components/min_renovasjon/__init__.py similarity index 100% rename from min_renovasjon/__init__.py rename to custom_components/min_renovasjon/__init__.py diff --git a/custom_components/min_renovasjon/config_flow.py b/custom_components/min_renovasjon/config_flow.py new file mode 100644 index 0000000..a1a3153 --- /dev/null +++ b/custom_components/min_renovasjon/config_flow.py @@ -0,0 +1,6 @@ +from homeassistant import config_entries +from .const import DOMAIN + + +class ExampleConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): + """Example config flow.""" diff --git a/custom_components/min_renovasjon/manifest.json b/custom_components/min_renovasjon/manifest.json new file mode 100644 index 0000000..e585e18 --- /dev/null +++ b/custom_components/min_renovasjon/manifest.json @@ -0,0 +1,12 @@ +{ + "domain": "min_renovasjon", + "name": "Min renovasjon", + "config_flow": false, + "documentation": "https://github.com/eyesoft/home_assistant_min_renovasjon", + "issue_tracker": "https://github.com/eyesoft/home_assistant_min_renovasjon/issues", + "codeowners": ["@eyesoft"], + "dependencies": [], + "requirements": [], + "version": "1.0.0", + "iot_class": "local_polling" +} diff --git a/min_renovasjon/sensor.py b/custom_components/min_renovasjon/sensor.py similarity index 100% rename from min_renovasjon/sensor.py rename to custom_components/min_renovasjon/sensor.py diff --git a/hacs.json b/hacs.json new file mode 100644 index 0000000..8d8f5cc --- /dev/null +++ b/hacs.json @@ -0,0 +1,5 @@ +{ + "name": "Min renovasjon", + "render_readme": true, + "country": ["NO"] +} diff --git a/min_renovasjon/manifest.json b/min_renovasjon/manifest.json deleted file mode 100644 index 3575fb7..0000000 --- a/min_renovasjon/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "min_renovasjon", - "name": "Min renovasjon", - "documentation": "", - "dependencies": [], - "codeowners": [], - "requirements": [], - "iot_class": "local_polling", - "version": "1.0.0" -} \ No newline at end of file