Skip to content

Commit d3cd5a4

Browse files
committed
Version 0.10.0
Bump growcube-client to 1.2.0 Add automatic reconnect Update images Refactor logging
1 parent c0a5831 commit d3cd5a4

File tree

8 files changed

+184
-70
lines changed

8 files changed

+184
-70
lines changed

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
Home Assistant integration for the [Elecrow GrowCube](https://www.elecrow.com/growcube-gardening-plants-smart-watering-kit-device.html), a smart plant watering device.
55

66
> Please note that a Growcube device can only be connected to one client at a time. That means you
7-
> will not be able to connect using the phone app while Home Assistant is running the integration.
7+
> will not be able to connect using the phone app while Home Assistant is running the integration,
8+
> or vice versa.
9+
10+
## Getting help
11+
12+
You can reach me at [#jonnys-place](https://discord.gg/SeHKWPu9Cw) on Brian Lough's Discord.
813

914
## Device
1015

1116
![device1.png](https://raw.githubusercontent.com/jonnybergdahl/HomeAssistant_Growcube_Integration/main/images/device1.png)
1217

1318
## Sensors
1419

15-
The integration adds sensors for temperature, humidity and four sensors for moisture. It adds four controls for watering,
16-
this activates the pump for 5 seconds for the given channel.
20+
The integration adds sensors for temperature, humidity and four sensors for moisture.
1721

1822
![sensors1.png](https://raw.githubusercontent.com/jonnybergdahl/HomeAssistant_Growcube_Integration/main/images/sensors1.png)
1923

@@ -25,7 +29,7 @@ The diagnostics sensors includes things such as device lock, sensor disconnect w
2529

2630
## Controls
2731

28-
There are controls to let you manually water a plant.
32+
There are controls to let you manually water a plant. Thee will activate the pump for 5 seconds for a given outlet.
2933

3034
![controls1.png](https://raw.githubusercontent.com/jonnybergdahl/HomeAssistant_Growcube_Integration/main/images/controls1.png)
3135

@@ -74,11 +78,3 @@ Install the integration using HACS:
7478

7579
And that's it! Once you've added your GrowCube device, you should be able to see its status and control it from the Home Assistant web interface.
7680

77-
## Getting help
78-
79-
You can reach me in [#jonnys-place](https://discord.gg/SeHKWPu9Cw) on Brian Lough's Discord.
80-
81-
# TODO
82-
83-
- Add/Rename the diagnostics sensors to adhere to the last reverse engineering findings
84-
- Add reconnect logic after connection lost event

custom_components/growcube/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: dict):
5656

5757
return True
5858

59+
5960
async def async_unload_entry(hass: HomeAssistant, entry: dict):
6061
"""Unload the Growcube entry."""
6162
client = hass.data[DOMAIN][entry.entry_id]

custom_components/growcube/binary_sensor.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ def is_on(self):
5959

6060
@callback
6161
def update(self) -> None:
62-
_LOGGER.debug("Update device_locked %s", self._coordinator.data.device_locked)
62+
_LOGGER.debug("%s: Update device_locked %s",
63+
self._coordinator.data.device_id,
64+
self._coordinator.data.device_locked
65+
)
6366
if self._coordinator.data.device_locked != self._attr_native_value:
6467
self._attr_native_value = self._coordinator.data.device_locked
6568
self.schedule_update_ha_state()
@@ -93,7 +96,10 @@ def is_on(self):
9396

9497
@callback
9598
def update(self) -> None:
96-
_LOGGER.debug("Update water_state %s", self._coordinator.data.water_warning)
99+
_LOGGER.debug("%s: Update water_state %s",
100+
self._coordinator.data.device_id,
101+
self._coordinator.data.water_warning
102+
)
97103
if self._coordinator.data.water_warning != self._attr_native_value:
98104
self._attr_native_value = self._coordinator.data.water_warning
99105
self.schedule_update_ha_state()
@@ -129,9 +135,11 @@ def is_on(self):
129135

130136
@callback
131137
def update(self) -> None:
132-
_LOGGER.debug("Update pump_state[%s] %s",
138+
_LOGGER.debug("%s: Update pump_state[%s] %s",
139+
self._coordinator.data.device_id,
133140
self._channel,
134-
self._coordinator.data.pump_open[self._channel])
141+
self._coordinator.data.pump_open[self._channel]
142+
)
135143
if self._coordinator.data.pump_open[self._channel] != self._attr_native_value:
136144
self._attr_native_value = self._coordinator.data.pump_open[self._channel]
137145
self.schedule_update_ha_state()
@@ -167,9 +175,11 @@ def is_on(self):
167175

168176
@callback
169177
def update(self) -> None:
170-
_LOGGER.debug("Update pump_lock_state[%s] %s",
178+
_LOGGER.debug("%s: Update pump_lock_state[%s] %s",
179+
self._coordinator.data.device_id,
171180
self._channel,
172-
self._coordinator.data.outlet_locked_state[self._channel])
181+
self._coordinator.data.outlet_locked_state[self._channel]
182+
)
173183
if self._coordinator.data.outlet_locked_state[self._channel] != self._attr_native_value:
174184
self._attr_native_value = self._coordinator.data.outlet_locked_state[self._channel]
175185
self.schedule_update_ha_state()
@@ -180,7 +190,7 @@ def __init__(self, coordinator: GrowcubeDataCoordinator, channel: int) -> None:
180190
self._coordinator = coordinator
181191
self._coordinator.entities.append(self)
182192
self._channel = channel
183-
self._attr_unique_id = f"{coordinator.data.device_id}_outlet_" + self.CHANNEL_ID[channel] + "_blocked"
193+
self._attr_unique_id = f"{coordinator.data.device_id}_outlet_" + CHANNEL_ID[channel] + "_blocked"
184194
self.entity_id = f"{Platform.SENSOR}.{self._attr_unique_id}"
185195
self._attr_name = f"Outlet " + CHANNEL_NAME[channel] + " blocked"
186196
self._attr_device_class = BinarySensorDeviceClass.PROBLEM
@@ -205,9 +215,11 @@ def is_on(self):
205215

206216
@callback
207217
def update(self) -> None:
208-
_LOGGER.debug("Update pump_lock_state[%s] %s",
218+
_LOGGER.debug("%s: Update pump_lock_state[%s] %s",
219+
self._coordinator.data.device_id,
209220
self._channel,
210-
self._coordinator.data.outlet_blocked_state[self._channel])
221+
self._coordinator.data.outlet_blocked_state[self._channel]
222+
)
211223
if self._coordinator.data.outlet_blocked_state[self._channel] != self._attr_native_value:
212224
self._attr_native_value = self._coordinator.data.outlet_blocked_state[self._channel]
213225
self.schedule_update_ha_state()
@@ -243,9 +255,11 @@ def is_on(self):
243255

244256
@callback
245257
def update(self) -> None:
246-
_LOGGER.debug("Update sensor_state[%s] %s",
258+
_LOGGER.debug("%s: Update sensor_state[%s] %s",
259+
self._coordinator.data.device_id,
247260
self._channel,
248-
self._coordinator.data.sensor_abnormal[self._channel])
261+
self._coordinator.data.sensor_abnormal[self._channel]
262+
)
249263
if self._coordinator.data.sensor_abnormal[self._channel] != self._attr_native_value:
250264
self._attr_native_value = self._coordinator.data.sensor_abnormal[self._channel]
251265
self.schedule_update_ha_state()
@@ -281,9 +295,11 @@ def is_on(self):
281295

282296
@callback
283297
def update(self) -> None:
284-
_LOGGER.debug("Update sensor_state[%s] %s",
298+
_LOGGER.debug("%s: Update sensor_state[%s] %s",
299+
self._coordinator.data.device_id,
285300
self._channel,
286-
self._coordinator.data.sensor_disconnected[self._channel])
301+
self._coordinator.data.sensor_disconnected[self._channel]
302+
)
287303
if self._coordinator.data.sensor_disconnected[self._channel] != self._attr_native_value:
288304
self._attr_native_value = self._coordinator.data.sensor_disconnected[self._channel]
289305
self.schedule_update_ha_state()

0 commit comments

Comments
 (0)