Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the nearest bikes as geolocation-sensors to display in the map #2

Open
hendrikma opened this issue Sep 18, 2021 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@hendrikma
Copy link
Contributor

hendrikma commented Sep 18, 2021

Hey folks,

I loaded the Nexbike integration a few days ago and am very excited! It is part of my daily routine before I leave the house to check where the nearest bikes are, since I am very much on the road with it.

Unfortunately, the addon only allows me to check how many bikes exist in a specified radius. Here in Cologne, no stations are used, but the bikes are everywhere on the streets around.

It would be super helpful if you could display the nearby bikes in the map.

So far I have solved it like this:

sensor:
 - 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') }}

Unfortunately, this goes only for the closest bike! But I would like to be able to see, for example, the nearest 5 bikes in the map!

@syssi syssi added the enhancement New feature or request label Jan 3, 2022
@syssi syssi changed the title Request: Get the nearest bikes as geolocation-sensors to display in the map Get the nearest bikes as geolocation-sensors to display in the map Jan 3, 2022
@pschonmann
Copy link

+1

@pschonmann
Copy link

Is possible to make sensor use my actual lat/lon for near bikes to change dynamically ? This shows only near bikes in my home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants