Have it served from homeassistant itself
https://my-ip:8123/local/file.json
json file in local folder
Now we just need a switch
Have it served from homeassistant itself
https://my-ip:8123/local/file.json
json file in local folder
Now we just need a switch
Could someone help with how to use this component?
What steps am I missing?
You have to add the sensor under your sensor attribute:
- platform: mijnafvalwijzer
postcode: !secret afvalwijzer_postcode
huisnummer: !secret afvalwijzer_huisnummer
toevoeging: !secret afvalwijzer_toevoeging
Thanks! That did the trick.
@xirixiz fantastic component and very usefull. Maybe you can update the script so it use httpS (https://github.com/xirixiz/home-assistant/blob/master/custom_components/sensor/mijnafvalwijzer.py#L58), currently youāre using http :(. AfvalWijzer works secure, they badly donāt force itā¦
HI @xirixiz
you probably noticed followingthe tag I created , but please update the custom component with the correct version format, so the custom component card can track your component:
Hahaha, great job Marius! Iāve been quiet busy, so I didnāt found the time yet to investigate this matter.
I just adjusted the custom_component with āversion = ā1.1.4āā. Can you verify if itās working?
The custom_component now uses https
If someone could make this work for IVIO, thatād be brilliant!
Iāve got a bad feeling that ivio doesnāt have a public rest api though
I will, but have to see if this update doesnāt brake any of the sensors and automations I use, while still on 1.0.2ā¦
I am trying to get this to work, but when I add the sensor information in my configuration file all my sensors disappear in my dashboard.
Also checking the configuration file through the settings page (I am using Hassio) does not seem to work. It does not say it is not valid, but it keeps showing like it is checking.
Any ideas what I can check?
Just to confirm, I have the following in my configuration file:
Postcode is not real.
I have /config/custom_components/sensor/mijnafvalwijzer.py for the custom component
please format your code correctly (using the </>) so we can see if the code is alright.
you should have this in your yaml:
sensor:
- platform: mijnafvalwijzer
postcode: !secret postcode
huisnummer: !secret huisnummer
the path of the file is correct.
youāre sure the py file itself is copied correctly? You should download the raw file, (and check if it isnāt 0 bytes also, have seen that fly by here)
It was the py file itself, thanks for the tip on the raw file download. That was the problem.
Not sure how it happened, but the file was 102KB. After doing a raw download it is 7KB and working!
Great! Thans Marius for providing support, Iāve been quiet busy lately
It was working fine (0.82.x) and then I updated to (0.83.3)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f2500041518>: Failed to establish a new connection: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='json.mijnafvalwijzer.nl', port=443): Max retries exceeded with url: /?method=postcodecheck&%20%20%20%20%20%20%20%20%20%20%20%20%20postcode=1234AB&street=&huisnummer=1&toevoeging=&%20%20%20%20%20%20%20%20%20%20%20%20%20platform=phone&langs=nl& (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2500041518>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/sensor/mijnafvalwijzer.py", line 114, in update
self.data.update()
File "/usr/src/app/homeassistant/util/__init__.py", line 324, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/sensor/mijnafvalwijzer.py", line 133, in update
response = requests.get(self._url)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='json.mijnafvalwijzer.nl', port=443): Max retries exceeded with url: /?method=postcodecheck&%20%20%20%20%20%20%20%20%20%20%20%20%20postcode=1234AB&street=&huisnummer=1&toevoeging=&%20%20%20%20%20%20%20%20%20%20%20%20%20platform=phone&langs=nl& (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f2500041518>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
Anyone else got this issue?
Hi, Iām using currently the 'mijnafvalwijzer.nl component. There are a few things that are strange.
The ācustom updaterā in configuration.yaml is giving errors. Iāve deactivated at the moment and the dates are still correct.
Also itās showing the āempty binā icon, and Iāam some how not able to change that to the nice png shown in this topic (in customization.yaml).
my customization.yaml code:
sensor.trash_gft:
friendly_name: 'GFT'
templates:
entity_picture: >
if (state === 'gft') return '/icons/Afvalwijzer/gft.png';
_stateDisplay: >
if (state === 'gft') return 'GFT';
Iām doing something wrong, but what? who can point me in the right direction.
Thanks!
because the template looks for a state āgftā while in fact it is a time sensor:
also,your spacing is rather offā¦and you should also take care for the āelseā, and if no option is needed, state null
.
not sure if it solves your issue but at least code like this:
sensor.trash_gft:
friendly_name: 'GFT'
templates:
entity_picture: >
if (state === 'gft') return '/icons/Afvalwijzer/gft.png';
return null;
_stateDisplay: >
if (state === 'gft') return 'GFT';
return null;
that being said, fwiw, I have hidden these sensors and created a few template sensors based on:
afval_vandaag:
friendly_name: 'Afval vandaag'
value_template: >-
{% if is_state('sensor.afval_datum', 'vandaag') %}
{{states('sensor.afval_soort')}}
{% else %}
Geen
{% endif %}
entity_picture_template: >
{% set mapper = {'Papier': '/local/mijnafvalwijzer/papier.png',
'Groente, Fruit en Tuinafval': '/local/mijnafvalwijzer/gft.png',
'Plastic verpakkingsafval': '/local/mijnafvalwijzer/plastic.png',
'Restafval': '/local/mijnafvalwijzer/restafval.png'} %}
{% set state = states('sensor.afval_vandaag') %}
{{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko.png' }}
and
- platform: scrape
resource: !secret scrape_resource_date
name: Afval Datum
select: ".firstDate"
scan_interval: 60
- platform: scrape
resource: !secret scrape_resource_type
name: Afval Soort
select: ".firstWasteType"
scan_interval: 60
Hi Sjorsjes, dit you notice this error
Failed to establish a new connection: [Errno 101] Network is unreachable',
Is it resolved now? It seems you couldnāt establish a connection to mijnafvalwijzer.nl, or mijnafvalwijzer.nl had some issues.
I also released a new version recently (1.1.5). Now, if there are multiple pickups Today or Tomorrow, the sensor provides a comma seperated list of all garbage types.
Yeah I think that me or afvalwijzer just had a connection hiccup and canāt reproduce the error. I updated to 1.1.5 and, with some lovelace love and template magic, it works like a charm Just need to spend some time to find better resolution icons