ginkage / MHI-AC-Ctrl-ESPHome

ESPHome integration for MHI-AC-Ctrl project
MIT License
111 stars 39 forks source link

Possible to display technical values? #1

Closed DYLaKo closed 2 years ago

DYLaKo commented 3 years ago

First of all: Great work! I already am using the MHI-AC-Ctrl in one of my airco controllers, but wanted to switch to ESPHome if possible. Your project made it possible to run my second airco with ESPHome. I like it!

Question: With the original MHI-AC-Ctrl, a lot of technical values are send to MQTT, see below for an example. Is it also possible to read this data through your ESPHome version?

        connected = 1
        RSSI = -48
        fSCK = 3200 
        fMOSI = 520
        fMISO = 0
        Mode = off
        Power = off
        Fan = 1
        Vanes = ?
        Troom = 25.75
        Tsetpoint = 26
        Errorcode = 0
            OpData
                Mode = heat
                Tsetpoint = 26
                RETURN-AIR = 26.00
                THI-R1 = 46
                THI-R2 = 58
                IU-FANSPEED = 0
                OUTDOOR = 8.00
                COMP = 0.00
                THO-R1 = 1
                TD = 60
                THI-R3 = 52
                CT = 3.57
                PROTECTION-NO = 0
                OU-FANSPEED = 3
                DEFROST = off
                TOTAL-COMP-RUN = 100
                OU-EEV1 = 150
                TDSH = 14
ginkage commented 3 years ago

Should be possible, the values themselves are there, see here for example. These values are still received, they're just not exposed, and it should be a fairly trivial modification to add them as additional sensors. Unfortunately I'm too far from my home where my aircons are, and unlikely to visit it in a few months, so I can't test modifications that would expose these. But the source code is open, so feel free to contribute or bring the community's attention to the project, I'm sure somebody will happily take on this task.

DYLaKo commented 3 years ago

I should be able to do some modifications myself if I know where to start. :-) Is it possible to help me out with some code/modification for 1 sensor, so I can do the rest myself? I know you cannot test, but I can test for you. :-)

ginkage commented 3 years ago

Sounds good. :) I've created a new branch, and pushed two sample commits there, to demo adding an integer sensor, a float sensor, and a binary sensor, with icons and measurement units. Not sure if this is going to be enough, but it's worth a try.

ginkage commented 3 years ago

Note that it might be a better idea to expose these as attributes rather than sensors. I'll look into it a bit later.

DYLaKo commented 3 years ago

I will try your new branch this weekend and post the results here.

ginkage commented 3 years ago

On a related note, attributes seem to be impossible with ESPHome: https://github.com/esphome/feature-requests/issues/115

deku-m commented 3 years ago

@ginkage Did you also notice the new changelog 1.19.0 https://esphome.io/changelog/v1.19.0.html (attributes for home assistant sensor?

ginkage commented 3 years ago

@deku-m Yes, I saw that one, I believe that's the exact opposite: it's for reading attributes from existing entities, rather than exposing my own attributes.

deku-m commented 3 years ago

Ah damn to bad haha i just had to upgrade and saw the changelog and remember your feedback xD

DYLaKo commented 3 years ago

Still haven't found time to test.. sorry Will test next week to see the results.

ginkage commented 3 years ago

Just in case, merged the main branch in, so that you can try it with ESPHome 1.19.4 for whenever you have time.

OperKH commented 3 years ago

I've created a new branch, and pushed two sample commits there, to demo adding an integer sensor, a float sensor, and a binary sensor, with icons and measurement units. Not sure if this is going to be enough, but it's worth a try.

Made a tiny build fix in #9 PR and its works!

image
ginkage commented 3 years ago

I believe the PR mentioned above is not required though.

SomeSander commented 3 years ago

Hi @ginkage ,

The new branch works great!! I also saw other people in the Home Assistant Dutch Facebook group confirming this. Would it be helpful to add it to the master for future users with a switch to enable/disable technical logging? In my case I did make some adjustments, as the ID and name in home assistant isn't really clear, as it belongs to the MHI device. Also I have two MHI airco's hence adjusted the names and base ID at the custom sensors.

Do you know if the ID can be set also directly in the custom platform? I couldn't find it at: https://esphome.io/components/sensor/custom.html Now it is derived from the name, but I think it is helpful to keep them separate. Next to that it would help to add a variable with the the Airco name, so the climate and sensors are based on the same prefix.

`climate:

sensor:

binary_sensor:

edit: While the sensors are only a subset (only noticed the remarks late :) ) it works great. Additional sensors should be trivial, but looking at the .h file it is complex for me as I don't have experience here. Wondering if @DYLaKo already already have included all sensors.

DYLaKo commented 3 years ago

edit: While the sensors are only a subset (only noticed the remarks late :) ) it works great. Additional sensors should be trivial, but looking at the .h file it is complex for me as I don't have experience here. Wondering if @DYLaKo already already have included all sensors.

To be honest, I had some turbulent months in which I used my spare time to relax instead of working on my home automation, so both MHi's in my house are still running with the code from the original MHI-AC-Ctrl project.

Hope to use this is in the near future.

ginkage commented 2 years ago

Would it be helpful to add it to the master for future users with a switch to enable/disable technical logging?

I'll get to that, hopefully soon enough.

SomeSander commented 2 years ago

Would it be helpful to add it to the master for future users with a switch to enable/disable technical logging?

I'll get to that, hopefully soon enough.

No issues. Great that your are willing already, thanks!

arpiecodes commented 2 years ago

I've added some more sensors in my pull request; https://github.com/ginkage/MHI-AC-Ctrl-ESPHome/pull/16. If you want, you could test it out and report back if it works for you. Also, let me know if you are still missing any sensors, I'll happily try to add them.