Netro Integration

Sorry for the late reply, I posted most of my code here: GitHub - TurboTronix/Hassio-DIY-ethernet-controlled-irrigation

2 Likes

Thank you so much for sharing!
can you enter the lovelace configuration as well?

I donā€™t have any Lovelace dashboard for that because I only use it to automate some things. I have a button to start a manual irrigation but it is a standard button entity card.

I am working on the integration l, I hope it can be ready after Easter, I will keep you guys posted :blush:

2 Likes

ok ok :sweat_smile:
thank you for the integration!

Dear all,

I just developed a Netro Smart Garden integration for Home Assistant.

Take a look here if interested: GitHub - kcofoni/ha-netro-watering: Netro Smart Garden integration for Home Assistant.

Best regards

5 Likes

What a great job!!! Thanks for sharing

1 Like

Thank you @Yoryino for your encouragement :+1:. Tenā€™s of downloading/cloning have been performed but very few feedback. Maybe itā€™s not buggy enough so that people enjoy silently :wink: Good news :sunglasses:

You are right, no news, good news. Good job. Thx and regards.

1 Like

What a great job!!! I have no words.
Superb!

Thanks a lot.

1 Like

Hi,
This is amazing. Iā€™m on vacation now but Iā€™ll test it this weekend.

Jens

Great job! Thank you very much.

I started the integration myself but never finished itā€¦ Thanks for making it happen :blush:

I did manage to get the pip package published: netrohomeapi Ā· PyPI
in case it helps you in the future.

One thing I implemented (well, not fully obviously) is the calendar, so when you have the smart algorithm planning the schedule for you, you can see it in home assistant and act accordingly. I havenā€™t gone deep into your code, but I think that if you want, it should be fairly easy to add it, here is my code:

calendar.py


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities):
    hub: NetroHomeHub = hass.data[DOMAIN][entry.entry_id]

    entities = []
    
    irrigation_calendar = NetroCalendar(
        hub=hub,
        name="Irrigation",
        key="irrigation",
    )
    
    entities.append(irrigation_calendar)
    
        
    _LOGGER.debug("Adding calendars")    
    async_add_entities(entities)
    return True

class NetroCalendar(NetroHomeHubEntity,CalendarEntity):
    _required_endpoints = [EPK_SCHEDULES]
    _all_events:list[CalendarEvent] = []
    _event: CalendarEvent = None
    _attr_icon: str = "mdi:calendar-clock"
    
    

    @callback
    def _on_new_data(self):
        events = self._hub.get_irrigation_calendar_events()
        events = [] if events is None else events
        events = [
            CalendarEvent(
                start=e.start_time,
                end=e.end_time,
                summary=self._hub.zone_names.get(e.zone, f"Zone {e.zone}"),
                description=f"Duration: {e.duration}. Source: {e.source}",
            ) for e in events
        ]
        self._all_events = events
        self._event = min(events, key=lambda x: x.start) if len(events) > 0 else None
        self.async_write_ha_state()
        
    async def async_get_events(
        self,
        hass: HomeAssistant,
        start_date: datetime.datetime,
        end_date: datetime.datetime,
    ) -> list[CalendarEvent]:
        """Get all events in a specific time frame."""
        return [e for e in self._all_events if e.start > start_date and e.start < end_date]
    
    
    @property
    def event(self) -> CalendarEvent | None:
        return self._event
    

Again, thank you and keep it up!

Thank you for your post @GeorgeBark.

Adding a calendar including coming schedules is definitely a so good idea :+1:. I am going to study the way to integrate in the code.

I am a bit busy at the moment so it will not be done in the next few days unfortunately. If you have the courage to look at my code and want to contribute, donā€™t hesitate to suggest a PR. It will be a pleasure to share the authorship of this integration with you. You seem to have a good knowledge of home assistant so it would probably be very beneficial for the ā€œmanyā€ users :wink:

Looking forward to reading from you :slightly_smiling_face:

1 Like