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

add garden device to group entities (#10) #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions custom_components/aerogarden/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.helpers.entity import DeviceInfo

Check warning on line 4 in custom_components/aerogarden/binary_sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/binary_sensor.py#L4

Added line #L4 was not covered by tests

from .. import aerogarden

Expand Down Expand Up @@ -48,6 +49,18 @@
self._aerogarden.update()
self._state = self._aerogarden.garden_property(self._macaddr, self._field)

@property
def device_info(self) -> DeviceInfo:

Check warning on line 53 in custom_components/aerogarden/binary_sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/binary_sensor.py#L52-L53

Added lines #L52 - L53 were not covered by tests
"""Return the device info."""
return DeviceInfo(

Check warning on line 55 in custom_components/aerogarden/binary_sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/binary_sensor.py#L55

Added line #L55 was not covered by tests
identifiers={
# Serial numbers are unique identifiers within a specific domain
self._macaddr
},
name=self._garden_name,
model=self._aerogarden.garden_property,
)


def setup_platform(hass, config, add_entities, discovery_info=None):
ag = hass.data[aerogarden.DOMAIN]
Expand Down
13 changes: 13 additions & 0 deletions custom_components/aerogarden/light.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from homeassistant.components.light import LightEntity
from homeassistant.helpers.entity import DeviceInfo

Check warning on line 4 in custom_components/aerogarden/light.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/light.py#L4

Added line #L4 was not covered by tests

from .. import aerogarden

Expand Down Expand Up @@ -54,6 +55,18 @@
self._aerogarden.update()
self._state = self._aerogarden.garden_property(self._macaddr, self._field)

@property
def device_info(self) -> DeviceInfo:

Check warning on line 59 in custom_components/aerogarden/light.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/light.py#L58-L59

Added lines #L58 - L59 were not covered by tests
"""Return the device info."""
return DeviceInfo(

Check warning on line 61 in custom_components/aerogarden/light.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/light.py#L61

Added line #L61 was not covered by tests
identifiers={
# Serial numbers are unique identifiers within a specific domain
self._macaddr
},
name=self._garden_name,
model=self._aerogarden.garden_property,
)


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Aerogarden platform"""
Expand Down
14 changes: 13 additions & 1 deletion custom_components/aerogarden/sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import DeviceInfo, Entity

Check warning on line 3 in custom_components/aerogarden/sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/sensor.py#L3

Added line #L3 was not covered by tests

from .. import aerogarden

Expand Down Expand Up @@ -54,6 +54,18 @@
self._aerogarden.update()
self._state = self._aerogarden.garden_property(self._macaddr, self._field)

@property
def device_info(self) -> DeviceInfo:

Check warning on line 58 in custom_components/aerogarden/sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/sensor.py#L57-L58

Added lines #L57 - L58 were not covered by tests
"""Return the device info."""
return DeviceInfo(

Check warning on line 60 in custom_components/aerogarden/sensor.py

View check run for this annotation

Codecov / codecov/patch

custom_components/aerogarden/sensor.py#L60

Added line #L60 was not covered by tests
identifiers={
# Serial numbers are unique identifiers within a specific domain
self._macaddr
},
name=self._garden_name,
model=self._aerogarden.garden_property,
)


def setup_platform(hass, config, add_entities, discovery_info=None):
"""Setup the aerogarden platform"""
Expand Down
Loading