Skip to content

Commit

Permalink
update issue flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram van Dartel authored and github-actions[bot] committed Jan 18, 2022
1 parent 64677d2 commit dfc7fcd
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 90 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

blank_issues_enabled: false
contact_links:
- name: Ask a question in the HASS community
- name: 🙋 Ask a question in the HASS community
url: https://community.home-assistant.io/t/garbage-pickup-date-mijnafvalwijzer-nl-custom-component/34631
about: If you are unsure where to go, then contacting the HASS community is recommended; Just ask!
about: If you are unsure where to go, then contacting the HASS community is recommended; Just ask!
63 changes: 36 additions & 27 deletions .github/ISSUE_TEMPLATE/issue.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
name: 🚨 Report an issue
description: Report an issue.
body:
- type: markdown
- type: checkboxes
attributes:
value: |
This issue form is for reporting bugs.
label: Support guidelines
description: Please read the support guidelines before proceeding.
options:
- label: I've read the [support guidelines](https://github.com/xirixiz/homeassistant-afvalwijzer/blob/master/.github/SUPPORT.md)
required: true

- type: textarea
attributes:
label: Description
description: Please provide a brief description of the issue in 1-2 sentences.
validations:
required: true
attributes:
label: Issue
description: >-
Describe the issue you are experiencing here to communicate to the
maintainers. Tell us what you were trying to do and what happened.

Provide a clear and concise description of what the problem is.
- type: input
id: version
- type: textarea
attributes:
label: Expected behaviour
description: Please describe precisely what you'd expect to happen.
validations:
required: true

- type: textarea
attributes:
label: Which version has the issue?
description: >
Can be found in the About section.
- type: input
attributes:
label: What was the last working version?
description: >
If known, otherwise leave blank.
label: Actual behaviour
description: Please describe precisely what is actually happening.
validations:
required: true

- type: textarea
attributes:
label: Anything in the logs that might be useful?
description: For example, error message, or stack traces.
render: txt
label: Version
description: Please provide the HASS version, component version and system information (ARM, Docker, anything usefull).
value: |
* HASS version:
* Component version:
* Useful system info:
validations:
required: true

- type: textarea
attributes:
label: Additional information
description: >
If you have any additional information, use the field below.
Please note, you can attach screenshots or screen recordings here, by
dragging and dropping files in the field below.
label: HASS logs
description: Please provide the HASS logs (preferably with debug enabled).
value: |
* logger -> logs -> custom_components.afvalwijzer: debug in you configuration.yaml
validations:
required: true
29 changes: 29 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Support [![](https://isitmaintained.com/badge/resolution/xirixiz/homeassistant-afvalwijzer.svg)](https://isitmaintained.com/project/xirixiz/homeassistant-afvalwijzer)

## Reporting an issue

Please do a search in [open issues](https://github.com/xirixiz/homeassistant-afvalwijzer/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.

If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.

:+1: - upvote

:-1: - downvote

If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.

## Writing good bug reports and feature requests

File a single issue per problem and feature request.

* Do not enumerate multiple bugs or feature requests in the same issue.
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.

The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.

You are now ready to [create a new issue](https://github.com/xirixiz/homeassistant-afvalwijzer/issues/new/choose)!

## Closure policy

* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
* Issues that go a week without a response from original poster are subject to closure at my discretion.
42 changes: 34 additions & 8 deletions custom_components/afvalwijzer/collector/mijnafvalwijzer.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
from datetime import datetime

import requests

from ..common.day_sensor_data import DaySensorData
from ..common.next_sensor_data import NextSensorData
from ..const.const import (
_LOGGER,
DATE_TODAY,
DATE_TOMORROW,
SENSOR_COLLECTOR_TO_URL,
SENSOR_COLLECTORS_AFVALWIJZER,
)
from ..common.day_sensor_data import DaySensorData
from ..common.next_sensor_data import NextSensorData


class MijnAfvalWijzerCollector(object):
def __init__(
self, provider, postal_code, street_number, suffix, exclude_pickup_today, exclude_list, default_label
self,
provider,
postal_code,
street_number,
suffix,
exclude_pickup_today,
exclude_list,
default_label,
):
self.provider = provider
self.postal_code = postal_code
Expand Down Expand Up @@ -62,7 +70,10 @@ def get_waste_data_provider(self):
raise ValueError("No JSON data received from " + url)

try:
waste_data_raw = json_response["ophaaldagen"]["data"] + json_response["ophaaldagenNext"]["data"]
waste_data_raw = (
json_response["ophaaldagen"]["data"]
+ json_response["ophaaldagenNext"]["data"]
)
except ValueError:
raise ValueError("Invalid and/or no JSON data received from " + url)

Expand Down Expand Up @@ -114,7 +125,13 @@ def transform_waste_data(self):

try:
waste_types_provider = sorted(
set(list(waste["type"] for waste in self.waste_data_raw if waste["type"] not in self.exclude_list))
set(
list(
waste["type"]
for waste in self.waste_data_raw
if waste["type"] not in self.exclude_list
)
)
)
except Exception as err:
_LOGGER.error("Other error occurred waste_types_provider: %s", err)
Expand All @@ -135,10 +152,14 @@ def transform_waste_data(self):

try:
waste_data_after_date_selected = list(
filter(lambda waste: waste["date"] >= date_selected, waste_data_formatted)
filter(
lambda waste: waste["date"] >= date_selected, waste_data_formatted
)
)
except Exception as err:
_LOGGER.error("Other error occurred waste_data_after_date_selected: %s", err)
_LOGGER.error(
"Other error occurred waste_data_after_date_selected: %s", err
)

next = NextSensorData(waste_data_after_date_selected, self.default_label)

Expand All @@ -152,7 +173,12 @@ def transform_waste_data(self):
except Exception as err:
_LOGGER.error("Other error occurred waste_types_custom: %s", err)

return waste_data_provider, waste_types_provider, waste_data_custom, waste_types_custom
return (
waste_data_provider,
waste_types_provider,
waste_data_custom,
waste_types_custom,
)

##########################################################################
# PROPERTIES FOR EXECUTION
Expand Down
55 changes: 43 additions & 12 deletions custom_components/afvalwijzer/collector/ximmio.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
from datetime import datetime

import requests

from ..common.day_sensor_data import DaySensorData
from ..common.next_sensor_data import NextSensorData
from ..const.const import (
_LOGGER,
DATE_TODAY,
DATE_TOMORROW,
DATE_TODAY_NEXT_YEAR,
SENSOR_COLLECTORS_XIMMIO,
DATE_TOMORROW,
SENSOR_COLLECTOR_TO_URL,
SENSOR_COLLECTORS_XIMMIO,
)
from ..common.day_sensor_data import DaySensorData
from ..common.next_sensor_data import NextSensorData


class XimmioCollector(object):
def __init__(
self, provider, postal_code, street_number, suffix, exclude_pickup_today, exclude_list, default_label
self,
provider,
postal_code,
street_number,
suffix,
exclude_pickup_today,
exclude_list,
default_label,
):
self.provider = provider
self.postal_code = postal_code
Expand Down Expand Up @@ -97,8 +105,12 @@ def get_waste_data_provider(self):

for item in waste_data_raw:
temp = {}
temp["type"] = self.__waste_type_rename(item["_pickupTypeText"].strip().lower())
temp["date"] = datetime.strptime(item["pickupDates"][0], "%Y-%m-%dT%H:%M:%S").strftime("%Y-%m-%d")
temp["type"] = self.__waste_type_rename(
item["_pickupTypeText"].strip().lower()
)
temp["date"] = datetime.strptime(
item["pickupDates"][0], "%Y-%m-%dT%H:%M:%S"
).strftime("%Y-%m-%d")
waste_data_raw_formatted.append(temp)

for item in waste_data_raw_formatted:
Expand Down Expand Up @@ -128,7 +140,11 @@ def get_waste_data_provider(self):
except Exception as err:
_LOGGER.error("Other error occurred: %s", err)

return waste_data_raw_formatted, waste_data_with_today, waste_data_without_today
return (
waste_data_raw_formatted,
waste_data_with_today,
waste_data_without_today,
)
except Exception as err:
_LOGGER.error("Other error occurred: %s", err)

Expand Down Expand Up @@ -174,7 +190,13 @@ def transform_waste_data(self):

try:
waste_types_provider = sorted(
set(list(waste["type"] for waste in self.waste_data_raw if waste["type"] not in self.exclude_list))
set(
list(
waste["type"]
for waste in self.waste_data_raw
if waste["type"] not in self.exclude_list
)
)
)
except Exception as err:
_LOGGER.error("Other error occurred waste_types_provider: %s", err)
Expand All @@ -195,10 +217,14 @@ def transform_waste_data(self):

try:
waste_data_after_date_selected = list(
filter(lambda waste: waste["date"] >= date_selected, waste_data_formatted)
filter(
lambda waste: waste["date"] >= date_selected, waste_data_formatted
)
)
except Exception as err:
_LOGGER.error("Other error occurred waste_data_after_date_selected: %s", err)
_LOGGER.error(
"Other error occurred waste_data_after_date_selected: %s", err
)

next = NextSensorData(waste_data_after_date_selected, self.default_label)

Expand All @@ -212,7 +238,12 @@ def transform_waste_data(self):
except Exception as err:
_LOGGER.error("Other error occurred waste_types_custom: %s", err)

return waste_data_provider, waste_types_provider, waste_data_custom, waste_types_custom
return (
waste_data_provider,
waste_types_provider,
waste_data_custom,
waste_types_custom,
)

##########################################################################
# PROPERTIES FOR EXECUTION
Expand Down
2 changes: 1 addition & 1 deletion custom_components/afvalwijzer/common/day_sensor_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..const.const import _LOGGER, DATE_TODAY, DATE_TOMORROW, DATE_DOT
from ..const.const import _LOGGER, DATE_DOT, DATE_TODAY, DATE_TOMORROW


class DaySensorData(object):
Expand Down
8 changes: 6 additions & 2 deletions custom_components/afvalwijzer/const/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
"afvalwijzer_data_default": [
"https://api.{0}.nl/webservices/appsinput/?apikey=5ef443e778f41c4f75c69459eea6e6ae0c2d92de729aa0fc61653815fbd6a8ca&method=postcodecheck&postcode={1}&street=&huisnummer={2}&toevoeging={3}&app_name=afvalwijzer&platform=phone&afvaldata={4}&langs=nl&"
],
"afvalstoffendienstkalender": ["https://{0}.afvalstoffendienstkalender.nl/nl/{1}/{2}/"],
"afvalstoffendienstkalender-s-hertogenbosch": ["https://afvalstoffendienstkalender.nl/nl/{0}/{1}/"],
"afvalstoffendienstkalender": [
"https://{0}.afvalstoffendienstkalender.nl/nl/{1}/{2}/"
],
"afvalstoffendienstkalender-s-hertogenbosch": [
"https://afvalstoffendienstkalender.nl/nl/{0}/{1}/"
],
"ximmio01": [
"https://wasteapi.ximmio.com/api/FetchAdress",
"https://wasteapi.ximmio.com/api/GetCalendar",
Expand Down
Loading

0 comments on commit dfc7fcd

Please sign in to comment.