Git Product home page Git Product logo

cardiffwaste-ha's Introduction

hacs_badge

Cardiff Waste: Home Assistant Integration

A, currently very, basic integration to provide waste collection date sensors for those whose waste is collected by Cardiff Council.

Installation

HACS

  1. Search for and download the "Cardiff Waste" integration
  2. Restart your Home Assistant
  3. Follow the setup instructions below

Manual

  1. Copy the cardiffwaste folder from this repository to the custom_components repository in your Home Assistant's configuration directory (the same place as your configuration.yaml)
  2. Restart you Home Assistant
  3. Follow the setup instructions below

Setup

For ease you can skip the first two steps using this my.home-assistant link:

Open your Home Assistant instance and start setting up a new integration.

  1. Go to Devices & Services in Configuration
  2. Click Add Integration and select Cardiff Waste
  3. When prompted add your properties post code and press submit
  4. After the search completes, select your address from the drop down and press submit

Configuration

By default, sensors will be created for the next food waste, garden waste, general waste and recycling collections, by default a sensor is not created for the next hygiene waste collection as not all properties receive these. You can remove or recreate any of these by clicking on the "Configure" button in the Cardiff Waste panel within Devices & Services form the Configuration menu.

cardiffwaste-ha's People

Contributors

dependabot[bot] avatar inverse avatar tombrien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cardiffwaste-ha's Issues

Error: Config flow could not be loaded

Trying to add this integration as per the instructions in the README but I repeatedly get the error "Config flow could not be loaded". Tried restarting the server and trying again but it didn't help

Logger: homeassistant.config_entries
Source: config_entries.py:711
First occurred: 18:09:02 (1 occurrences)
Last logged: 18:09:02

Error occurred loading configuration flow for integration cardiffwaste: cannot import name 'Platform' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

Handle None JWT response

2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Starting sorting bins
2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Requesting JWT
2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Completed JWT request with status code: 200
2022-03-09 13:08:40 ERROR (MainThread) [custom_components.cardiffwaste] Unexpected error fetching cardiffwaste data: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/cardiffwaste/__init__.py", line 111, in _async_update_data
return await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 201, in get_next_collections
response = self.get_raw_collections()
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 145, in get_raw_collections
jwt = _get_token(self._user_agent)
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 50, in _get_token
result = json.loads(xml.find("GetJWTResult").get_text())
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2022-03-09 13:08:40 DEBUG (MainThread) [custom_components.cardiffwaste] Finished fetching cardiffwaste data in 0.274 seconds (success: False)

Handle empty cookie jar

2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Starting sorting bins
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Requesting JWT
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Completed JWT request with status code: 200
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Attempting to get collection cookies
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Received 0 cookies
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Attempting to get collection data
2022-03-09 12:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Completed collection data request with status code: 502
2022-03-09 12:08:40 ERROR (MainThread) [custom_components.cardiffwaste] Unexpected error fetching cardiffwaste data: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/cardiffwaste/__init__.py", line 111, in _async_update_data
return await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 201, in get_next_collections
response = self.get_raw_collections()
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 166, in get_raw_collections
raw["collections"] = json.loads(response.text)["collectionWeeks"]
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Just thanks

Hi Tom,
Just wanted to say thank you for sharing this.
Great work! Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.