jcgoette / baby_buddy_homeassistant

This custom integration provides sensors for Baby Buddy API endpoints.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DRY

github-actions opened this issue · comments

DRY

        sensor = [sensors for sensors in self.entities_get() if sensors[0] == sensor]

        return sensor

    def entities_delete(self, endpoint, data):
        # TODO: DRY
        session = sessions.BaseUrlSession(base_url=self.form_address())
        session.headers = {"Authorization": f"Token {self._api_key}"}

        delete = session.delete(f"{endpoint}/{data}/")

        if not delete.ok:
            _LOGGER.error(
                "Cannot delete %s, check service fields",
                endpoint,
            )

a8ceb7e9d2877f724c228a39175fac246975ba3c