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

Tank full alert #4

Open
elvenpath opened this issue Jun 13, 2021 · 13 comments
Open

Tank full alert #4

elvenpath opened this issue Jun 13, 2021 · 13 comments

Comments

@elvenpath
Copy link

There doesn't seem to be a tank full alert in the firmware. Is it possible to add? Will be quite useful

Thanks

@ghost
Copy link

ghost commented Jun 21, 2021

I would like to second this. This is really the issue preventing me from using this approach.
Midea cloud does support tank full indication so this should be part of the serial protocol.

@Hypfer
Copy link
Owner

Hypfer commented Jun 21, 2021

The issue here is that the "Tank Full" Error is the same as "No Tank at all".
At least as far as my testing goes.

The error code already visible in the JSON published to the MQTT state topic so you can also take a look at that and observe it changing.

I agree that there should be some kind of autoconfigured HA sensor reporting the error state, however personally I'd want it to be reliable.

@ghost
Copy link

ghost commented Jun 21, 2021

can you point me to where this is in the JSON, please?
I'm going to access the raw MQTT topic here in order to include this into openHAB.
Many thanks!

@elvenpath
Copy link
Author

I did a search for both "tank" and "full" strings in the ino files and it doesn't seem to be anything related to this. Also can't seem to find anything in the MQTT topics. Am I doing something wrong?

@ghost
Copy link

ghost commented Jun 21, 2021

OK, it seems to be in the error code reported in the JSON.
But, what is the error code for tank full / tank missing?
For the dehumidifier device it is the same issue, both shows "P2" on the display.
Is there a list of know error codes available?
Besides this, great job done here!

@Hypfer
Copy link
Owner

Hypfer commented Jun 21, 2021

@elvenpath

The error code is read from the state response here:

and set to the published mqtt json here:

with the state topic being declared here:

snprintf(MQTT_TOPIC_STATE, 127, "%s/%s/state", FIRMWARE_PREFIX, identifier);

@clh27

Is there a list of know error codes available?

Unfortunately no. You'd have to figure those out by yourself by testing.
Just cause an error state and then look at the mqtt payload.

I guess it would be possible to introduce something like a errorDescription property for the known values

0 => "no error"
etc.

and then just have a HA sensor which shows that text.

At least that's what Valetudo is doing:

image

@Syntaxrabbit
Copy link
Contributor

Syntaxrabbit commented Aug 5, 2021

I just finished my OpenHAB configuration and tested the consequences of removing the water tray while the machine is running.
The error code did not change. Everything else works like a charm.

grafik

@Syntaxrabbit
Copy link
Contributor

Syntaxrabbit commented Nov 17, 2021

New insight: Errorcode for filled tank is 38.

@Chreece
Copy link

Chreece commented Feb 13, 2022

So I made an mqtt binary_sensor for home assistant to check for full tank.
Unfortunately couldn't parse the json to use {{ value_json }} and therefore I parsed everything as attribute an then checked for errorCode:

- platform: mqtt
  state_topic: 'esp8266-midea-dehumidifier/YOURDEHUMIDIFIER/state'
  json_attributes_topic: 'esp8266-midea-dehumidifier/YOURDEHUMIDIFIER/state'
  payload_on: "38"
  payload_off: "0"
  name: YOURNAME
  value_template: >
    {{ state_attr("binary_sensor.YOURNAME","errorCode") | default(0,true) | string }}

change YOURDEHUMIDIFIER with your dehumidifier name from mqtt topic and YOURNAME for the name from your sensor to also match the binary_sensor in value_template

@lennvilardi
Copy link

lennvilardi commented Dec 1, 2024

I've rewritten your code parsing the json :

mqtt:
  binary_sensor:
    - name: "Tank Full"
      state_topic: "esp8266-midea-dehumidifier/YOURDEHUMIDIFIER/state"
      value_template: "{{ 'ON' if value_json.errorCode == 38 else 'OFF' if value_json.errorCode == 0 else 'OFF' }}"
      payload_on: "ON"
      payload_off: "OFF"
      device_class: problem
      unique_id: yourdehumidifier_tank_full

and to add the binary sensor to the device add :

    qos: 1
    device:
      identifiers: ["YOURDEHUMIDIFIER"]
      name: "YOURDEHUMIDIFIER"
      manufacturer: "Midea Group Co., Ltd."
      model: "2023.08.0"

@QuentinYT
Copy link

Hi,
Do you have the entire arduino code ?

@lennvilardi
Copy link

This isn’t embedded in the firmware, so there’s no Arduino code. However, since it reports via MQTT, you just need to create a binary sensor in the Home Assistant configuration file under the MQTT section.

@QuentinYT
Copy link

QuentinYT commented Jan 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants