fermartv / emt_madrid

Custom sensor to have the arrival time of the EMT Madrid buses in Home Assistant
MIT License
12 stars 1 forks source link

Platform common #1

Closed segalion closed 1 year ago

segalion commented 3 years ago

Could be great include platform parameters on common part, and sensor for each bus-stop pair....

sensor:

Seems that component is using http "requests", so I think that HA will make a thread for each sensor, what could be a little heavy for a lot of sensors...

Maybe a better aproach could be an only-one platform and and all sensors updated at a time. Could be great too a sensor for a stop, with all next bus and times inside atribute sensors... for each stop.

fermartv commented 3 years ago

Thanks for your suggestion! I don't quite understand your request. You mean to have something like this?:

sensor:
  - platform: emt_madrid
    email: !secret EMT_EMAIL
    password: !secret EMT_PASSWORD
    stops:
      - stop: "72"
        line: "27"
        name: "Bus 27 en Cibeles"
        icon: "mdi:fountain"

      - stop: "35"
        line: "67"
        name: "Bus 67 en other"
        icon: "mdi:fountain"

How many sensors do you need? For my personal use case, I just needed 2 and that's why I thought that having them independently would be easier to manage.

ccorderod commented 3 years ago

Hola.

Great component @fermartv . Thank you very much!. I have the same request as @segalion; in my case I have to monitor 6 of them. Would it be possible to integrate “Metro Ligero” (Lines C1, ...) as well or do we need another component for this?

Thank you. Stay safe.

alnavasa commented 3 years ago

Working great!, Love it, Need now the CRTM (comunidad de madrid) and other transports like metro, Renfe, or Autobus interurbano.

fermartv commented 1 year ago

I'm currently working on a new update to address this problem. The upcoming release will offer the option to include additional lines within the same configuration, as long as they belong to the same bus stop. This enhancement will generate a separate sensor for each line. Moreover, the API calls will be shared across all the sensors, ensuring a more resource-efficient operation.

@ccorderod @alnavasa As far as I know, there isn't a public API available for the data you mentioned. However, if you happen to know how to obtain those specific data, I'd be happy to work on integrating them. Just let me know!

Once again, thank you for using this custom_component, and I appreciate your feedback.