Ecowater softener -> how to integrate this python script?

The integration was working for couple days like a charm, but yesterday, without any changes it disconencted and now I cannot get any data from ecowater. I can login to the ecowater website and mobile app without any issues, but the data are not coming to HA. Has anybody seen similar issue?

I don’t have any problem here, still works as usual

Hi, i tried this but I cant get it to work Please can you help.

Running Home Assistant Supervised 2021.7.4 on Raspberry Pi 4

Here is what I did:

Created Mqtt-user in HA

Supervisor > Add-On Store > Installed Mosquitto broker Enabled Boot and Watchdog > Start > Restarted HA

Configuration > integrations > added MQTT that was found by HA with Mqtt-user details

Supervisor > Add-On Store > Installed AppDaemon 4 (v0.6.2) > Enabled Boot, Watchdog and Auto update > Start > Restarted HA

File Editor - I can see new appdaemon folder created with defaults

Configuration > integrations > HACS > Configure > Enabled “Enable AppDaemon apps discovery & tracking” > Restarted HA

File Editor > Edited /config/appdaemon/apps/apps.yaml and added the following

EcoWater:
  module: ecowater
  class: EcoWater
  ecowater_minutes: 60
  ecowater_dsn: 'ACxxxxxxxxxxxxx'
  ecowater_email: '[email protected]'
  ecowater_password: 'xxxxxxxxxx'

File Editor > created /config/appdaemon/apps/ecowater.py and pasted contents from here

File Editor > edited ‘/config/appdaemon/appdaemon.yaml’ and added this to the end.

MQTT:
  type: mqtt
  namespace: mqtt
  verbose: True

File Editor > edited /config/configuration.yaml and added:

sensor:
  - platform: mqtt
    name: Out of Salt Days
    state_topic: "ecowater/out_of_salt_days"
    unit_of_measurement: 'days'

  - platform: mqtt
    name: Ecowater Salt Level
    state_topic: "ecowater/salt_level"
  
  - platform: mqtt
    name: Ecowater Salt Level Percent
    state_topic: "ecowater/salt_level_percent"
    unit_of_measurement: '%'
  
  - platform: mqtt
    name: Ecowater Water Today
    state_topic: "ecowater/water_today"
    unit_of_measurement: "gallons"
  
  - platform: mqtt
    name: Ecowater Water Average
    state_topic: "ecowater/water_avg"
    unit_of_measurement: "gallons"
  
  - platform: mqtt
    name: Ecowater Water Available
    state_topic: "ecowater/water_avail"
    unit_of_measurement: "liters"
  
  - platform: mqtt
    name: Ecowater Water Flow
    state_topic: "ecowater/water_flow"
    unit_of_measurement: "GPM"

binary_sensor:
- platform: mqtt
  name: Ecowater Online
  state_topic: "ecowater/online"
  payload_on: True
  payload_off: False

- platform: mqtt
  name: Ecowater Recharge Enabled
  state_topic: "ecowater/recharge"
  payload_on: True
  payload_off: False
  
- platform: mqtt
  name: Ecowater Out oF Salt
  state_topic: "ecowater/out_of_salt"
  payload_on: True
  payload_off: False

Restarted and added the entities entities to HA but All I see is Off and Unknown…

Anything I missed or did wrong ?

Thanks in Advance.

Hi All,

It seems like its working now but intermittently. It comes and goes. Anybody else noticed that.

Thanks for all your help

Hi rbhalla, I did not experience such problem, but note that the script only pulls the data from Ecowater every 60 minutes, so don’t expect live values.

@kalhimeo
Thak you so much, it’s working!

1 Like

Looks like the app doesn’t capture the initial data for 60mins from first run.

Is it possible to update it so it connects and captures the data at startup, then run every X minutes after to refresh?

Hi, normally it should do an initial update at startup, but you may try to modify this line in ecowater.py :

self.run_every(self.run_parsing, datetime.datetime.now() + timedelta(seconds=3), self.args["ecowater_minutes"] * 60)

to

self.run_every(self.run_parsing, datetime.datetime.now() + timedelta(seconds=60), self.args["ecowater_minutes"] * 60)

Not sure if will help as I am not the coder of the original script (I only adapted it for Appdaemon), but you can give it a try

Thanks, will look at that line.

I reduced the delay by modifying

ecowater_minutes: 60

to

ecowater_minutes: 10

which runs the script every 10 mins, but still waits for the first data acquisition.

Giving it sone thought, it’s only an issue after a restart, so I’m not going to worry too much if I can’t solve it easily.

You can indeed increase the polling cylce, but it will have a big impact for such a rare problem.
Modifying the line above defines when to start the first run : normally scheduled at actual time + 3 seconds, changed to +60 seconds as maybe other components are not ready yet on your system (network, internet connection ?).

The python script stopped working with the latest update of appdaemon, which bumps the python version to 3.10.
Not much info in the appdeamon log, except:
2022-07-12 14:41:42.735619 WARNING EcoWater: Traceback (most recent call last):
File “/usr/lib/python3.10/site-packages/appdaemon/threading.py”, line 904, in worker
funcref(self.AD.sched.sanitize_timer_kwargs(app, args[“kwargs”]))
File “/config/appdaemon/apps/ecowater.py”, line 70, in run_parsing
jsonv = json.loads(data.text)
File “/usr/lib/python3.10/json/init.py”, line 346, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.10/json/decoder.py”, line 340, in decode
raise JSONDecodeError(“Extra data”, s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)

Anyone with any insights?

Thx

P.

I Patrick, I stopped maintaining this script as someone made an integration accessible via HACS : https://github.com/barleybobs/homeassistant-ecowater-softener
It works fine with the latest HA version :wink:

2 Likes

I have that integration installed also, but you have to click on attributes to actually see them.
With yours all attributes were always visible.

Any chance of giving the script the necessary python 3.10 update?

Thx

Patrick

Sorry I won’t be able to do that, I am not the creator of the python script, I only adapted it to make it work with appdaemon, so my python knowledge is too limited :frowning:

I have an ecowater eVolution 400 Boost water softener, but even this site does not work for me: https://www.wifi.ecowater.com/Site/Login

you may try to replace the url with

https://wifi.ecowater.com/Site/Login

1 Like

Thank you!
If anyone is interested, this is how I broke down attributes to entities using this integration:

template:
  - sensor:
      #Ecowater Softener
      - name: "Ecowater Days until out of salt"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'days_until_out_of_salt') }}"
        icon: mdi:calendar-end
        device_class: duration
        unit_of_measurement: 'day(s)'
      - name: "Ecowater Out of salt on"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'out_of_salt_on') }}"
        icon: mdi:calendar-today-outline
      - name: "Ecowater Salt level"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'salt_level_percentage') }}"
        unit_of_measurement: '%'
        icon: mdi:page-layout-header
      - name: "Ecowater Water used today"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'water_used_today') }}"
        unit_of_measurement: 'l'
        icon: mdi:water-plus-outline
      - name: "Ecowater Water used per day average"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'water_used_per_day_average') }}"
        unit_of_measurement: 'l'
        icon: mdi:water-percent
      - name: "Ecowater water available"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'water_available') }}"
        unit_of_measurement: 'l'
        icon: mdi:waves

  - binary_sensor:
      #Ecowater Softener
      - name: "Ecowater status"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'status') }}"
        #icon: mdi:power
      - name: "Ecowater Recharge enabled"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'recharge_enabled') }}"
      - name: "Ecowater Recharge scheduled"
        state: "{{ state_attr('sensor.ecowater_ac000w007138272', 'recharge_scheduled') }}"
2 Likes

Hi

I have just noticed my homeassistant hasn’t been getting updates from appdaemon for my ecowater, i have changed the URL to wifi.ecowater.com on all 3 entries in the ecowater.py file, but im still getting this in the logs

> 2022-09-19 22:32:35.764040 WARNING EcoWater: ------------------------------------------------------------
> 2022-09-19 22:32:35.764727 WARNING EcoWater: Unexpected error in worker for App EcoWater:
> 2022-09-19 22:32:35.765301 WARNING EcoWater: Worker Ags: {'id': '021be9db5994475bb87bae8ee79b21ff', 'name': 'EcoWater', 'objectid': '941e300f672f435d8bc793ec07aa3df7', 'type': 'scheduler', 'function': <bound method EcoWater.run_parsing of <ecowater.EcoWater object at 0x7f49342fc8b0>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 900, '__thread_id': 'thread-0'}}
> 2022-09-19 22:32:35.765773 WARNING EcoWater: ------------------------------------------------------------
> 2022-09-19 22:32:35.766626 WARNING EcoWater: Traceback (most recent call last):
>   File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker
>     funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
>   File "/config/appdaemon/apps/ecowater.py", line 70, in run_parsing
>     jsonv = json.loads(data.text)
>   File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
>     return _default_decoder.decode(s)
>   File "/usr/lib/python3.10/json/decoder.py", line 340, in decode
>     raise JSONDecodeError("Extra data", s, end)
> json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)
> 2022-09-19 22:32:35.766995 WARNING EcoWater: ------------------------------------------------------------
> 2022-09-19 22:32:35.770734 WARNING AppDaemon: callback run_parsing() in EcoWater has now completed

any one seen this before? any ideas whats wrong?

Thanks

Neil

You may try this integration:

Has anyone created this for Hoobs?