As long as the citybikes component and API doesn’t support free-floating areas/bikes I will maintain this custom component integrating the Nextbike API:
Hi @syssi. Thanks for creating this component which I found today via HACS.
I can add a sensor according to your sample code on Git.
But unfortunately I fail on creating sensors with city id: 6
Any idea how to fix this:
- platform: nextbike
name: Nextbike Test
city_id: 6
latitude: 49.4479
longitude: 11.0814
radius: 800
It looks like the city_id
s has changed. Nuenberg (VAG_RAD) is city_id 626.
Works! Thanks for your help and for this component.
I’ve updated the list of city ids and added a hint how to lookup new cities.
Thanks a lot for this component, its really great!
I just integrated it in my home assistance instance like so:
- platform: nextbike
name: Nextbike Radius Home 150
city_id: !secret nextbike_city
latitude: !secret nextbike_lat
longitude: !secret nextbike_lon
radius: 150
template:
- binary_sensor:
- name: Nextbike Closest Bike
icon: mdi:bike
state: >
{% if states('sensor.nextbike_radius_home_150') | float > 0 %} on {% endif %}
attributes:
latitude: >
{% if states('sensor.nextbike_radius_home_150') | float > 0 %}
{{ state_attr('sensor.nextbike_radius_home_150', 'closest_latitude') }}
{% else %}
{{ state_attr('zone.home', 'latitude') }}
{% endif %}
longitude: >
{% if states('sensor.nextbike_radius_home_150') | float > 0 %}
{{ state_attr('sensor.nextbike_radius_home_150', 'closest_longitude') }}
{% else %}
{{ state_attr('zone.home', 'longitutde') }}
{% endif %}
bike: >
{{ state_attr('sensor.nextbike_radius_home_150', 'closest_bikes') }}
I thought it would be great to have a little map with the nearest bikes. So when I leave my house, all I have to do is look at my wall mounted tablet to know how far away and in which direction the nearest bike is. To do this, I created a binary_sensor. This is on when a bike is closer than 150 meters from my house. On a small Lovelace map I can then see where it is:
I would be happy if you could integrate this function into this great component. Maybe you can geolocate the next 5 bikes via sensors and show them on the map!
Unfortunately I don’t know py-scripting that well
Regards!