Skip to content

Commit

Permalink
Merge pull request #52 from jm-73/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jm-73 authored Jun 2, 2020
2 parents 6b95f64 + 17b10ab commit 2773b20
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 56 deletions.
18 changes: 10 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Changelog

## 0.8.0 2019-09-16
Tested with Hassio 0.98.5 and Bosch Indego 1000
## 0.8.0 2020-06-02
Tested with Hassio 0.110 and Bosch Indego 1000

### Changes
- Bumped pyIndego to 0.7.28
- Fix #32 component cant handle offline mower. Component now handles offline mower.
- Fix #36 Online/offline sensor. Mower state now shows if mower is online or offline.
- Fix #37 Add latest complete mowing. Last complete mowing is now shown as a property to sensor LawnMowed.
- Fix #38 Sensors not showing values when mower goes from offline to online. Sensors now updates after mower come back online.
- Fix #39 Error during setup of component indego. This error is due to the component raising an error when timing out instead of handling the error. HA does not want an error raised, then it stops initiating the component. This is now fixed.
- Bumped pyIndego to 0.8.10
- Added sensor for next mow. (Fix #39 Next mowing time)
- Component now handles offline mower. (Fix #32 component cant handle offline mower)
- Mower state now shows if mower is online or offline. (Fix #36 Online/offline sensor)
- A new sensor added for last completed mow. Value also shown as a property to sensor for Lawn Mowed. (Fix #37 Add latest complete mowing)
- Sensors now updates after mower come back online. (Fix #38 Sensors not showing values when mower goes from offline to online)
- This error is due to the component raising an error when timing out instead of handling the error. HA does not want an error raised, then it stops initiating the component. (Fix #39 Error during setup of component indego)
- Added model Indego S+ 350 2019.

## 0.7.4 2019-08-22
Tested with Hassio 0.97.2 and Bosch Indego 1000
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
[![GitHub release](https://img.shields.io/github/release/jm-73/Indego.svg)](https://GitHub.com/jm-73/Indego/releases/) [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)

# Indego
Join the Discord channel to discuss around this integration and vote for your favourite change to happen!
https://discord.gg/aD33GsP

Home Assistant Custom Component for Bosch Indego Lawn Mower.

![Entities in Home Asistant](/doc/0-Indego_sensors.png)

## Installation

### Alternative 1
Install via HACS Community Store: https://hacs.netlify.com/
Install via HACS Community Store: https://hacs.xyz/
### Alternative 2
Copy the folder `indego` in `custom_components` into your `custom_components` in your Home Assistant.


## Reboot
Reboot HA in order to get HA to find the newly added files.

## Configuration
Add the domain to your configuration.yaml
``` yaml
Expand All @@ -37,7 +44,8 @@ indego_id: 123456789
![Mower State](/doc/1-Indego_mower_state.png) ![Mower State](/doc/2-Indego_mower_state_detail.png)
![Lawn Mowed](/doc/3-Indego_lawn_mowed.png) ![Runtime Total](/doc/4-Indego_runtime_total.png)
![Battery sensor percent](/doc/5-Indego_battery.png) ![Battery sensor volt](/doc/6-Indego_battery_v.png)
![Battery sensor](/doc/7-Indego_alert.png)
![Battery sensor](/doc/7-Indego_alert.png) ![Last complete mow](/doc/9-Indego_complete.png)
![Next planned mow](/doc/10-Indego_next.png)
### Service
There are a service exposed to HA called **indego.mower_command**. It sends a specified command to the mower. Accepted commands are:
Expand Down
48 changes: 22 additions & 26 deletions custom_components/indego/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ def __init__(self):

### Initial update of variables
#IndegoAPI_Instance.initial_update()

#Get data for battery, mowingmode. And to know if mower is online!
IndegoAPI_Instance.getOperatingData()
IndegoAPI_Instance.Battery()
IndegoAPI_Instance.BatteryPercent()
IndegoAPI_Instance.BatteryPercentAdjusted()
IndegoAPI_Instance.BatteryVoltage()
IndegoAPI_Instance.BatteryCycles()
IndegoAPI_Instance.BatteryDischarge()
IndegoAPI_Instance.BatteryAmbientTemp()
IndegoAPI_Instance.BatteryTemp()

#Get data for State,
IndegoAPI_Instance.getState()
IndegoAPI_Instance.MowerStateDescription()
Expand All @@ -126,13 +114,25 @@ def __init__(self):
IndegoAPI_Instance.ModelVoltageMin()
IndegoAPI_Instance.ModelVoltageMax()

#Get data for battery, mowingmode
IndegoAPI_Instance.getOperatingData()
IndegoAPI_Instance.Battery()
IndegoAPI_Instance.BatteryPercent()
IndegoAPI_Instance.BatteryPercentAdjusted()
IndegoAPI_Instance.BatteryVoltage()
IndegoAPI_Instance.BatteryCycles()
IndegoAPI_Instance.BatteryDischarge()
IndegoAPI_Instance.BatteryAmbientTemp()
IndegoAPI_Instance.BatteryTemp()

#Get data for alerts
IndegoAPI_Instance.getAlerts()
IndegoAPI_Instance.AlertsCount()
IndegoAPI_Instance.AlertsDescription()

#Get last comlete mowing session time and date
#Get last cutting
IndegoAPI_Instance.getLastCutting()
IndegoAPI_Instance.getNextCutting()

### show vars
IndegoAPI_Instance.show_vars()
Expand All @@ -143,7 +143,14 @@ def __init__(self):
def refresh_1m(self):
_LOGGER.debug("++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
_LOGGER.debug(" Refresh Indego sensors every minute")

#Get data for State,
IndegoAPI_Instance.getState()
IndegoAPI_Instance.MowerStateDescription()
IndegoAPI_Instance.MowerStateDescriptionDetailed()
IndegoAPI_Instance.Runtime()
IndegoAPI_Instance.RuntimeTotal()
IndegoAPI_Instance.RuntimeSession()

#Get data for battery, mowingmode
IndegoAPI_Instance.getOperatingData()
IndegoAPI_Instance.Battery()
Expand All @@ -155,22 +162,11 @@ def refresh_1m(self):
IndegoAPI_Instance.BatteryAmbientTemp()
IndegoAPI_Instance.BatteryTemp()

#Get data for State,
IndegoAPI_Instance.getState()
IndegoAPI_Instance.MowerStateDescription()
IndegoAPI_Instance.MowerStateDescriptionDetailed()
IndegoAPI_Instance.Runtime()
IndegoAPI_Instance.RuntimeTotal()
IndegoAPI_Instance.RuntimeSession()

#Get data for alerts
IndegoAPI_Instance.getAlerts()
IndegoAPI_Instance.AlertsCount()
IndegoAPI_Instance.AlertsDescription()

#Get last comlete mowing session time and date
IndegoAPI_Instance.getLastCutting()


_LOGGER.debug(" Refresh end")
_LOGGER.debug("--------------------------------------------------------")
return True
Expand Down
2 changes: 1 addition & 1 deletion custom_components/indego/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"documentation": "https://github.com/jm-73/Indego",
"dependencies": [],
"codeowners": ["@jm-73"],
"requirements": ["pyIndego==0.7.28"]
"requirements": ["pyIndego==0.8.8"]
}
87 changes: 70 additions & 17 deletions custom_components/indego/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
mower_alert_sensor_name = GLOB_MOWER_NAME + ' mower alert'
add_devices([IndegoAlertSensor(API, mower_alert_sensor_name)])

last_cutting_sensor_name = GLOB_MOWER_NAME + ' last completed'
add_devices([IndegoLastCuttingSensor(API, last_cutting_sensor_name)])

next_cutting_sensor_name = GLOB_MOWER_NAME + ' next cutting'
add_devices([IndegoNextCuttingSensor(API, next_cutting_sensor_name)])

_LOGGER.debug("Finished Sensor Platform setup!")

class IndegoStateSensor(Entity):
Expand Down Expand Up @@ -112,14 +118,67 @@ def device_state_attributes(self):
'Last session Operation': str(self._IAPI._session_operation) + " min",
'Last session Cut': str(self._IAPI._session_cut) + " min",
'Last session Charge': str(self._IAPI._session_charge) + " min",
'Last completed cutting': str(self._IAPI._lastcutting)
'Last completed': str(self._IAPI._last_cutting),
'Next planned Mow': str(self._IAPI._next_cutting)
}
def should_poll(self):
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False

class IndegoLastCuttingSensor(Entity):
def __init__(self, IAPI, device_label):
self._mower = mower
self._IAPI = IAPI
self._state = None
self._device_label = device_label
@property
def name(self):
return self._device_label
#@property
#def unit_of_measurement(self):
# return '%'
@property
def icon(self):
return 'mdi:cash-100'
@property
def state(self):
return self._IAPI._last_cutting
#def update(self):
# self._mower.update(self)
def should_poll(self):
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False

class IndegoNextCuttingSensor(Entity):
def __init__(self, IAPI, device_label):
self._mower = mower
self._IAPI = IAPI
self._state = None
self._device_label = device_label
@property
def name(self):
return self._device_label
#@property
#def unit_of_measurement(self):
# return '%'
@property
def icon(self):
return 'mdi:chevron-right'
@property
def state(self):
return self._IAPI._next_cutting
#def update(self):
# self._mower.update(self)
def should_poll(self):
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False


class IndegoRuntimeTotal(Entity):
def __init__(self, IAPI, device_label):
Expand Down Expand Up @@ -202,14 +261,11 @@ def unit_of_measurement(self):
return '%'
@property
def state(self):
if (self._IAPI._battery_percent) and (self._battery_percent_max):
if (self._IAPI._battery_percent > self._battery_percent_max):
self._battery_percent_max = self._IAPI._battery_percent
if (self._IAPI._battery_percent < self._battery_percent_min):
self._battery_vpercent_min = self._IAPI._battery_percent
return self._IAPI._battery_percent_adjusted
else:
return None
if (self._IAPI._battery_percent > self._battery_percent_max):
self._battery_percent_max = self._IAPI._battery_percent
if (self._IAPI._battery_percent < self._battery_percent_min):
self._battery_vpercent_min = self._IAPI._battery_percent
return self._IAPI._battery_percent_adjusted
@property
def icon(self):
tmp_icon = 'mdi:battery-50'
Expand Down Expand Up @@ -245,14 +301,11 @@ def unit_of_measurement(self):
return 'V'
@property
def state(self):
if (self._IAPI._battery_voltage) and (self._battery_voltage_max):
if (self._IAPI._battery_voltage > self._battery_voltage_max):
self._battery_voltage_max = self._IAPI._battery_voltage
if (self._IAPI._battery_voltage < self._battery_voltage_min):
self._battery_voltage_min = self._IAPI._battery_voltage
return self._IAPI._battery_voltage
else:
return None
if (self._IAPI._battery_voltage > self._battery_voltage_max):
self._battery_voltage_max = self._IAPI._battery_voltage
if (self._IAPI._battery_voltage < self._battery_voltage_min):
self._battery_voltage_min = self._IAPI._battery_voltage
return self._IAPI._battery_voltage
@property
def icon(self):
tmp_icon = 'mdi:current-dc'
Expand Down
Binary file added doc/10-Indego_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/9-Indego_complete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "Bosch Indego Mower",
"country": "SE",
"domains": ["sensor"],
"homeassistant": "0.97.0"
"homeassistant": "1.110.0"
}

0 comments on commit 2773b20

Please sign in to comment.