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

HACS compatible #2

Open
cinghialino opened this issue Sep 29, 2021 · 6 comments
Open

HACS compatible #2

cinghialino opened this issue Sep 29, 2021 · 6 comments

Comments

@cinghialino
Copy link

I've noticed that currently the code isn't easily installed vis HACS, would you mind using that structure so more paople can use it (like myself?)

@iicky
Copy link
Owner

iicky commented Oct 2, 2021

Thanks for reaching out! I will take a look into the HACS project and see if I can refactor this sensor for compatibility - it also needs updating it for the latest version of HA.

@iicky
Copy link
Owner

iicky commented Oct 2, 2021

@cinghialino I was just able to install it using HACS by adding it as a custom repository, can you try it out and see if you can too? I'll work on getting it in the official store.

@cinghialino
Copy link
Author

@iicky thanks man! it installed flawlessly and it works as intended.

Three things for you to consider:

  • You still have to add the sensors to configuration.yaml yourself, maybe there is a way to avoid that (like install it and have the sensors available after a restart?)
  • Which "direction" should I use? How to set it?
  • Consider including the explanation of delays and interruptions of service as a secondary info without having to go into the attributes.

Thanks so much for the great work!

@iicky
Copy link
Owner

iicky commented Oct 3, 2021

@cinghialino Thanks for the feedback - I'm still learning HACS, so will check out if they have an easier way to configure upon install.

The MTA has changed their feed a bunch since I first authored this sensor, so trying to figure out if it makes sense to have things like direction in there (indicating uptown vs downtown) - if you look right now at the raw feed, they only have issues for direction 0. I think I may remove direction and just consolidate the line descriptions into one field called description.

The states of the sensor used to be simpler too - now they have a whole bunch of new codes. I was thinking about trying to map those to keep the same previous Good Service/Service Change/Delays/Planned Work states. What do you think?

@cinghialino
Copy link
Author

I think I may remove direction and just consolidate the line descriptions into one field called description

not sure about that. it may lead to confusion when monitoring a specific direction a train is going. I am monitoring the departures with a different integration, that takes advantage of the Realtime GTFS (https://github.com/zacs/ha-gtfs-rt) and using it together with yours allows me to get a glimpse of ongoing issues on my line.

The states of the sensor used to be simpler too - now they have a whole bunch of new codes. I was thinking about trying to map those to keep the same previous Good Service/Service Change/Delays/Planned Work states. What do you think?

I think it's inconvenient and it's should reflect the same statuses the MTA provides. I wish I could provide some help in coding to alleviate your nice work.

@fmonday
Copy link

fmonday commented Jul 31, 2024

This is very cool, thanks. You should publish it in the share your projects part of the HA forum... it's not in there at all.

FYI about directionality- with the attributes the way they are, this works:

  - type: custom:template-entity-row
    icon: mdi:numeric-3-circle
    name: "3 line service:"
    state: >-
      N: {{ state_attr("sensor.mta_subway_3", "direction_statuses").north }}  /  
      S: {{ state_attr("sensor.mta_subway_3", "direction_statuses").south }}
    card_mod:
      style: |
        :host {
          --paper-item-icon-color: red;
        }

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

No branches or pull requests

3 participants