Metadata-Version: 2.4
Name: ecowater-softener-hkbertoson
Version: 2.3.0
Summary: A small package to pull data from Ecowater water softeners. Fork of barleybobs/ecowater-softener with additional properties.
Home-page: https://github.com/hkbertoson/ecowater-softener
Author: Hunter Bertoson
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ayla-iot-unofficial==1.4.1
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Ecowater Softener

A Python library for collecting information from Ecowater water softeners.

This is a fork of [barleybobs/ecowater-softener](https://github.com/barleybobs/ecowater-softener) maintained by [Hunter Bertoson](https://github.com/hkbertoson), which exposes many additional device properties (water quality, capacity, salt usage, alerts, and diagnostics).

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install ecowater.

```bash
pip install ecowater-softener-hkbertoson
```

## Usage

Liquids are measured in **US Gallons**, liquid speeds are measured in **US Gallons per Minute (gpm)**, and weights are measured in **Pounds (lbs)**

Importing the library

```python
import ecowater_softener
```

### Account

Initialize Ecowater account using username and password credentials

```python
ecowater_account = ecowater_softener.EcowaterAccount('username', 'password')
```

### Devices

Retrieve a list of all devices associated with the Ecowater account

```python
devices = ecowater_account.get_devices()
```

Access the first device from the list of devices

```python
device = devices[0]
```

Get / Update the devices values (Needs to be ran before accessing data or the data will return None)

```python
device.update()
```

### Device Info

Get the device model (string)

```python
model = device.model
```

Get the device model display code (string)

```python
model_code = device.model_code
```

Get the device model id (integer)

```python
model_id = device.model_id
```

Get the system type (string)

```python
system_type = device.system_type
```

Get the device serial number (string)

```python
serial_number = device.serial_number
```

Get the device software version (string)

```python
software_version = device.software_version
```

Get the signal strength (rssi) (integer)

```python
rssi = device.rssi
```

Get the signal strength in bars (integer)

```python
signal_bars = device.signal_bars
```

Get the device ip address (string)

```python
ip_address = device.ip_address
```

Get the number of days the device has been in operation (integer)

```python
days_in_operation = device.days_in_operation
```

### Water

Get the average daily water usage (integer)

```python
water_use_avg_daily = device.water_use_avg_daily
```

Get the average daily water usage for each day of the week (list of 7 integers)

```python
water_use_avg_by_weekday = device.water_use_avg_by_weekday
```

Get the amount of water used today (integer)

```python
water_use_today = device.water_use_today
```

Get the current amount of available water (integer)

```python
water_available = device.water_available
```

Get the total amount of treated water used over the device's lifetime (integer)

```python
water_use_total = device.water_use_total
```

Get the total amount of untreated water used over the device's lifetime (integer)

```python
untreated_water_total = device.untreated_water_total
```

### Water Flow

Get the current water flow rate (float)

```python
current_water_flow = device.current_water_flow
```

Get the peak water flow rate (float)

```python
peak_water_flow = device.peak_water_flow
```

### Water Quality

Get the water temperature in °C (float)

```python
water_temperature = device.water_temperature
```

Get the average water temperature in °C (float)

```python
water_temperature_avg = device.water_temperature_avg
```

Get the total dissolved solids of the water in ppm (integer)

```python
water_tds = device.water_tds
```

### Capacity

Get the remaining softening capacity as a percentage (float)

```python
capacity_remaining_percentage = device.capacity_remaining_percentage
```

Get the average exhaustion percentage at recharge (float)

```python
exhaustion_percentage_avg = device.exhaustion_percentage_avg
```

Get the operating capacity in grains (integer)

```python
operating_capacity = device.operating_capacity
```

Get the configured water hardness in grains (integer)

```python
hardness = device.hardness
```

### Salt

Get the current salt level as a percentage (float)

```python
salt_level_percentage = device.salt_level_percentage
```

Get the number of days until the device runs out of salt (integer)

```python
out_of_salt_days = device.out_of_salt_days
```

Get the estimated date when the device will run out of salt (datetime.date)

```python
out_of_salt_date = device.out_of_salt_date
```

Get the salt type, either "NaCl" or "KCl" (string)

```python
salt_type = device.salt_type
```

Get the total amount of salt used over the device's lifetime (float)

```python
salt_use_total = device.salt_use_total
```

Get the average amount of salt used per recharge (float)

```python
salt_use_per_recharge_avg = device.salt_use_per_recharge_avg
```

Get the salt efficiency in grains per pound (integer)

```python
salt_efficiency = device.salt_efficiency
```

### Rock

Get the average amount of rock removed daily (float)

```python
rock_removed_avg_daily = device.rock_removed_avg_daily
```

Get the total amount of rock removed by the device over its lifetime (float)

```python
rock_removed = device.rock_removed
```

Get the amount of rock removed since the last recharge (float)

```python
rock_removed_since_recharge = device.rock_removed_since_recharge
```

### Recharge

Get the recharge status, either "None", "Scheduled", or "Recharging" (string)

```python
recharge_status = device.recharge_status
```

Check if recharge is enabled (boolean)

```python
recharge_enabled = device.recharge_enabled
```

Check if a recharge is scheduled (boolean)

```python
recharge_scheduled = device.recharge_scheduled
```

Check if recharging currently (boolean)

```python
recharge_recharging = device.recharge_recharging
```

Get the time remaining in the current recharge in seconds (integer)

```python
recharge_time_remaining = device.recharge_time_remaining
```

Get the total number of recharges (integer)

```python
recharge_count = device.recharge_count
```

Get the number of manual recharges (integer)

```python
manual_recharge_count = device.manual_recharge_count
```

Get the average number of days between recharges (float)

```python
recharge_days_between_avg = device.recharge_days_between_avg
```

Get the number of days since the last recharge was performed (integer)

```python
last_recharge_days = device.last_recharge_days
```

Get the date of the last recharge (datetime.date)

```python
last_recharge_date = device.last_recharge_date
```

### Alerts

Check if the low salt alert is active (boolean)

```python
low_salt = device.low_salt
```

Get the number of days before running out of salt at which the low salt alert trips (integer)

```python
low_salt_trip_level_days = device.low_salt_trip_level_days
```

Get the current error code, 0 when no error (integer)

```python
error_code = device.error_code
```

Check if the error alert is active (boolean)

```python
error_alert = device.error_alert
```

Check if the excessive water use alert is active (boolean)

```python
excessive_water_use = device.excessive_water_use
```

Check if the flow monitor alert is active (boolean)

```python
flow_monitor_alert = device.flow_monitor_alert
```

Check if the depletion alert is active (boolean)

```python
depletion_alert = device.depletion_alert
```

Check if the service reminder is active (boolean)

```python
service_reminder = device.service_reminder
```

### Diagnostics

Get the number of power outages (integer)

```python
power_outage_count = device.power_outage_count
```

Get the longest recorded outage in minutes (integer)

```python
longest_outage_minutes = device.longest_outage_minutes
```

Get the number of time lost events (integer)

```python
time_lost_events = device.time_lost_events
```

Get the number of days since time was last lost (integer)

```python
days_since_last_time_loss = device.days_since_last_time_loss
```


## Credits

-   [barleybobs](https://github.com/barleybobs) for creating the original [ecowater-softener](https://github.com/barleybobs/ecowater-softener) library which this fork is based on.
-   [Kyle Johnson](https://github.com/kylejohnson) for his work on using python to interface with Ecowater water softeners. Most of this libraries code was originally built upon code which he wrote. You can read his article regarding scraping data from Ecowater water softeners at https://gnulnx.net/2020/02/18/ecowater-api-scraping/
-   [@rewardone](https://github.com/rewardone) for creating [ayla-iot-unofficial](https://github.com/rewardone/ayla-iot-unofficial) which is used to fetch the data
-   [Jeff Rescignano](https://github.com/JeffResc) for creating [sharkiq](https://github.com/JeffResc/sharkiq) which [ayla-iot-unofficial](https://github.com/rewardone/ayla-iot-unofficial) is based on.

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License

[MIT](https://choosealicense.com/licenses/mit/)
