krasnoukhov/homeassistant-smart-maic

Pulse counter D105

Closed this issue · 11 comments

Hello,

I'm using pulse counter smart-maic-d105 with temperature / RH / pressure sensor.
I see only DO in integration and big doubts, that it is working.
Mqqt in HA is set correct. I see it with mqqt explorer.

What is strange, after installation of you integration, my manual settup of sensor via mqqt stopped work...
Sensor configuration in configuration file
mqtt:
sensor:
#Outside temperature
- name: "MAIC-T1"
unique_id: 'xxxxxx'
unit_of_measurement: 'Cel'
state_topic: "xxxxxxxx/T1"

Are you planning to integrate pulse counter also ?

Thanks a lot for your answer

Hello, I guess for manual set up you need to change topic because this integration overwrites topic.

I don't own a d105 device, but I can review and merge a PR if you can add the missing functionality

Maybe you or @TonioClos can provide a sample payload here so we can start looking

I would love if you explain me how to get that, I ended up doing it manually extracting information from the JSON without resorting to the integration in addons, but if I can help others doing it easier I would love to.
It´s just im kinda new to coding and don´t know what it is a sample payload or how to get it to copy it here.
Thank you for everything and sry if my english it´s not the best n_n

@TonioClos Could you just copy-paste that json here. Payload = json in this case

{
"TIME": 1713258045,
"T1": 0,
"T2": 0,
"T3": 0,
"T4": 0,
"T5": 0,
"ADC": 0,
"Ch1": 0,
"Ch2": 0,
"TCh1": 1474,
"TCh2": 0,
"OUT": 0
}
That´s what my JSON sends me, I used MQTT explorer

Ok thanks. I guess it would be somewhat tricky to integrate this one since these metrics can correspond to anything (we don't know whether you have temp/humidity sensor and what those pulses relate to), so I have to think about this. Any ideas would be welcome

I have the pulse counter that correspond to Ch1 and TCh1. Ch1 measure during a fixed amount of time, while TCh1 its de cumulative value, my main problem with the integration it´s that it doesn´t detect those entities, so I can only modify the switch.
The way I solve it was creating a new file in HA called mqtt and including it in config (just to keep it apart from the rest and doing it cleaner) then with chatgpt this code works fine:

#Este código parece funconar

sensor:
  - name: Caudalímetro 
    state_topic: "smart-maic/1778385987.JSON" 
# Importante poner JSON en mayus o no va a entender lo que tiene que leer
    json_attributes_topic: "smart-maic/1778385987.JSON"
    value_template: "{{ value_json.TCh1 | float / 65 }}"
# Con la operación esa, dividimos el valor de TCh1 (Acumulado) entre 65 ya que,
# según la página, son unos 65 pulsos por litro. 
    unique_id: caudalimetro
    unit_of_measurement: "L/s"

If you need anything more, just tell me

Hi @TonioClos and @romrazas, just published a beta version with preliminary support of D105. Please give it a try, you can do it via HACS (click "redownload" and then toggle "show beta versions"):

image

Hey! I´ll try this week and then tell you about it.
Thank you so much.

Edit:

Just tried it and its working for me now without any problem, I can see every entity given by the Smart MAIC.
Thanks for your work!

@TonioClos Are you able to use entities as is to suit your needs? I just don't know what entity type to choose by default so it works better

Yes! I can now use the entities I need. Before the update, only the dry switch will show.
For pulse counter its Ch1 and Ch2 and their cumulative TCh1 and TCh2, in my case using TCh1 and Ch1 but depends on the sensor.
As said before, thank you, if there is any problem, I´ll report it to you :)