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

Home Assistant #23

Closed
artbrayko opened this issue Jun 26, 2020 · 16 comments
Closed

Home Assistant #23

artbrayko opened this issue Jun 26, 2020 · 16 comments
Labels
question Further information is requested

Comments

@artbrayko
Copy link

Do you have an example of integration in Home assistant?

@absalom-muc
Copy link
Owner

Unfortunatelly I've no experience with Home assistant. In general you have to setup a MQTT server for receiving the messages from MHI-AC-Ctrl. But maybe @apateluk or @ThomasHFWright who discussed a Home assistant topic in this issue could support you.

@absalom-muc absalom-muc added the question Further information is requested label Jun 26, 2020
@apateluk
Copy link

apateluk commented Jun 26, 2020

You need to add the climate mqtt platform to your configuration. Note, I havn't tried the latest build of MHI-AC-Ctrl yet, but is meant to be more compatible with HA.
Below is my configuration, but note some of the string and topic names may be different to the defaults and HA likes everything to be lowercase.

climate:
  - platform: mqtt
    unique_id: mhi0001a
    name: LoftAC
    initial: 22
    min_temp: 18
    max_temp: 30
    modes:
      - "auto"
      - "dry"
      - "cool"
      - "fan_only"
      - "heat"
      - "off"
    swing_modes:
      - "1"
      - "2"
      - "3"
      - "4"
      - "Swing"
    fan_modes:
      - "1"
      - "2"
      - "3"
      - "4"
    mode_command_topic: "MHInterface/set/Mode"
    mode_state_topic: "MHInterface/Mode"
    temperature_command_topic: "MHInterface/set/Tsetpoint"
    temperature_state_topic: "MHInterface/Tsetpoint"
    fan_mode_command_topic: "MHInterface/set/Fan"
    fan_mode_state_topic: "MHInterface/Fan"
    swing_mode_command_topic: "MHInterface/set/Vanes"
    swing_mode_state_topic: "MHInterface/Vanes"
    current_temperature_topic: "MHInterface/Troom"

@artbrayko
Copy link
Author

Thanks, at least some understanding. If you still know what, please write.

@artbrayko
Copy link
Author

I added to configuration.yaml as you wrote above,
only the topic names were left by default (MHI-AC-Ctrl) but nothing happens. Please tell me what am I doing wrong?
In MQTT Explorer I can see that data is being transferred.
.........
............
mode_command_topic: "MHI-AC-Ctrl/set/Mode"
mode_state_topic: "MHI-AC-Ctrl/Mode"
temperature_command_topic: "MHI-AC-Ctrl/set/Tsetpoint"
temperature_state_topic: "MHI-AC-Ctrl/Tsetpoint"
fan_mode_command_topic: "MHI-AC-Ctrl/set/Fan"
fan_mode_state_topic: "MHI-AC-Ctrl/Fan"
swing_mode_command_topic: "MHI-AC-Ctrl/set/Vanes"
swing_mode_state_topic: "MHI-AC-Ctrl/Vanes"
current_temperature_topic: "MHI-AC-Ctrl/Troom"

@sstmelbourne
Copy link

At first thanks @absalom-muc for the great effort in the compiling.

I have set up my yaml as above, everything works except;

AC unit is off - can't switch the ac unit on from the UI of HA. However when a command "On" is sent to the the topic MHI-AC-Ctrl/set/Power via an mqtt.fx the AC unit turns on.

Once the AC is on, modes (heat, cool, dry) from the front UI of HA function, it will change on the AC as well.

When I switch to "Off" front he UI of HA it doesn't work and unit doesn't respond. - error I get when looked up on serial communication of D1 mini is "invalid command".

However, when an "Off" command is published from the mqtt.fx to the power topic it switches off.

In summary the on and off command are not working from the UI of the HA.

Anyone come up with this issue, if so any solution.

Thanks

@L4RGER
Copy link

L4RGER commented Jan 21, 2021

did you check the updated wiring picture absalin posted?

Also whats the topic for the DS18B20, i cannot get a readinf out of it.
i tried subscribing to TOPIC_TDS1820 "Tds1820"

@absalom-muc
Copy link
Owner

closed since there was no update for a long time. Please feel free to re-open in case of follow-up topics.

@hart0x
Copy link

hart0x commented Jun 17, 2022

At first thanks @absalom-muc for the great effort in the compiling.

I have set up my yaml as above, everything works except;

AC unit is off - can't switch the ac unit on from the UI of HA. However when a command "On" is sent to the the topic MHI-AC-Ctrl/set/Power via an mqtt.fx the AC unit turns on.

Once the AC is on, modes (heat, cool, dry) from the front UI of HA function, it will change on the AC as well.

When I switch to "Off" front he UI of HA it doesn't work and unit doesn't respond. - error I get when looked up on serial communication of D1 mini is "invalid command".

However, when an "Off" command is published from the mqtt.fx to the power topic it switches off.

In summary the on and off command are not working from the UI of the HA.

Anyone come up with this issue, if so any solution.

Thanks

If you add this line in HA (configuration.yaml):
power_command_topic: "MHI-AC-Ctrl/set/Power"

and change the following 2 lines in MHI-AC-Ctrl.h from:
#define PAYLOAD_POWER_ON "On"
#define PAYLOAD_POWER_OFF "Off"

to:
#define PAYLOAD_POWER_ON "ON"
#define PAYLOAD_POWER_OFF "OFF"

It seems to work then..

@scottm1985
Copy link

scottm1985 commented Nov 9, 2023

Has anybody got this working in Home Assistant with the new config layout?
I've got temperature working but for some reason I can't see the current operation or power status even though the MQTT topics are populated. This is the configuration I have currently:

mqtt:
  climate:
    unique_id: mhi0001a
    name: HeatPump
    initial: 18
    min_temp: 18
    max_temp: 30
    modes:
      - "auto"
      - "dry"
      - "cool"
      - "fan_only"
      - "heat"
      - "off"
    swing_modes:
      - "1"
      - "2"
      - "3"
      - "4"
      - "Swing"
    fan_modes:
      - "1"
      - "2"
      - "3"
      - "4"
    mode_command_topic: "MHI-AC-Ctrl/set/Mode"
    mode_state_topic: "MHI-AC-Ctrl/Mode"
    temperature_command_topic: "MHI-AC-Ctrl/set/Tsetpoint"
    temperature_state_topic: "MHI-AC-Ctrl/Tsetpoint"
    fan_mode_command_topic: "MHI-AC-Ctrl/set/Fan"
    fan_mode_state_topic: "MHI-AC-Ctrl/Fan"
    swing_mode_command_topic: "MHI-AC-Ctrl/set/Vanes"
    swing_mode_state_topic: "MHI-AC-Ctrl/Vanes"
    current_temperature_topic: "MHI-AC-Ctrl/Troom"

@glsf91 glsf91 reopened this Nov 9, 2023
@Timple
Copy link

Timple commented Nov 9, 2023

Honestly I just use: https://github.com/ginkage/MHI-AC-Ctrl-ESPHome
It's based on this nice project. But works out of the box for home assistant.

@Allinijhof
Copy link

I have been able to toggle / Target / Fan mode and Swing mode successfully, hence unfortunately I am not able to enable the features displayed under Mode.

If I select "Heat" = I can see a message has been send through MQTT topic: MHI-AC-Ctrl/set/Mode = heat

I can see a response through MQTT topic: MHI-AC-Ctrl/cmd_received = invalid parameter

Can you advice how to resolve the parameter issue?

Please find attached the software I have loaded on to the Wemos D1;

MHI-AC-Ctrl.zip

Please find below a screenshot of Home Assistant entity and MQTT explorer;

image

image

image

Please find below the code in configuration.yaml

mqtt:
climate:
unique_id: mhiacctrl
name: mhictrlac
initial: 15
min_temp: 15
max_temp: 30
modes:
- "auto"
- "dry"
- "cool"
- "fan_only"
- "heat"
- "off"
swing_modes:
- "1"
- "2"
- "3"
- "4"
- "Swing"
fan_modes:
- "1"
- "2"
- "3"
- "4"
mode_command_topic: "MHI-AC-Ctrl/set/Mode"
mode_state_topic: "MHI-AC-Ctrl/Mode"
temperature_command_topic: "MHI-AC-Ctrl/set/Tsetpoint"
temperature_state_topic: "MHI-AC-Ctrl/Tsetpoint"
fan_mode_command_topic: "MHI-AC-Ctrl/set/Fan"
fan_mode_state_topic: "MHI-AC-Ctrl/Fan"
swing_mode_command_topic: "MHI-AC-Ctrl/set/Vanes"
swing_mode_state_topic: "MHI-AC-Ctrl/Vanes"
current_temperature_topic: "MHI-AC-Ctrl/Troom"

Many thanks for your help!

Regards,
Allard

@scottm1985
Copy link

scottm1985 commented Nov 21, 2023

I figured this out after reading the documentation. There is a line in support.h

#define POWERON_WHEN_CHANGING_MODE true

that needs to be uncommented to be able to turn on and off with Home Assistant.
And then you need to change MHI-AC-Ctrl.h so that your mode payloads are as follows

#define PAYLOAD_MODE_AUTO "auto"
#define PAYLOAD_MODE_STOP "stop"
#define PAYLOAD_MODE_DRY "dry"
#define PAYLOAD_MODE_COOL "cool"
#define PAYLOAD_MODE_FAN "fan_only"
#define PAYLOAD_MODE_HEAT "heat"

Home Assistant is sending "heat" but your device is expecting "Heat". Home Assistant can only work with it lower case and so you have to change the payloads.
Your YAML looks correct.

@Allinijhof
Copy link

Excellent it working perfectly!

@Allinijhof
Copy link

@scottm1985 I have do want to add a second AC to Home Assistant, I have created a prefix HOSTNAME Room1 and Room2 however unfortunately the Dasboard in Home Assistant is no longer working. Once I delete either Room1 or Room2 (so basically just have one HOSTNAME / HOSTNAME prefix) the dashboard is working.

Could you please advise what I am missing?

#define MQTT_PREFIX HOSTNAME "/Room1/" // basic prefix used for publishing AC data (e.g. for status),
// replace "/" by e.g. "/Living-Room/" when you have multiple ACs

Please find below the details of the configuration.yaml file in Home Assistant.

mqtt:
climate:
unique_id: MHI-AC-Ctrl-Room1
name: MHI-AC-Ctrl-Room1
initial: 15
min_temp: 15
max_temp: 30
modes:
- "auto"
- "dry"
- "cool"
- "fan_only"
- "heat"
- "off"
swing_modes:
- "1"
- "2"
- "3"
- "4"
- "Swing"
fan_modes:
- "1"
- "2"
- "3"
- "4"
mode_command_topic: "MHI-AC-Ctrl/Room1/set/Mode"
mode_state_topic: "MHI-AC-Ctrl/Room1/Mode"
temperature_command_topic: "MHI-AC-Ctrl/Room1/set/Tsetpoint"
temperature_state_topic: "MHI-AC-Ctrl/Room1/Tsetpoint"
fan_mode_command_topic: "MHI-AC-Ctrl/Room1/set/Fan"
fan_mode_state_topic: "MHI-AC-Ctrl/Room1/Fan"
swing_mode_command_topic: "MHI-AC-Ctrl/Room1/set/Vanes"
swing_mode_state_topic: "MHI-AC-Ctrl/Room1/Vanes"
current_temperature_topic: "MHI-AC-Ctrl/Room1/Troom"
climate:
unique_id: MHI-AC-Ctrl-Room2
name: MHI-AC-Ctrl-Room2
initial: 15
min_temp: 15
max_temp: 30
modes:
- "auto"
- "dry"
- "cool"
- "fan_only"
- "heat"
- "off"
swing_modes:
- "1"
- "2"
- "3"
- "4"
- "Swing"
fan_modes:
- "1"
- "2"
- "3"
- "4"
mode_command_topic: "MHI-AC-Ctrl/Room2/set/Mode"
mode_state_topic: "MHI-AC-Ctrl/Room2/Mode"
temperature_command_topic: "MHI-AC-Ctrl/Room2/set/Tsetpoint"
temperature_state_topic: "MHI-AC-Ctrl/Room2/Tsetpoint"
fan_mode_command_topic: "MHI-AC-Ctrl/Room2/set/Fan"
fan_mode_state_topic: "MHI-AC-Ctrl/Room2/Fan"
swing_mode_command_topic: "MHI-AC-Ctrl/Room2/set/Vanes"
swing_mode_state_topic: "MHI-AC-Ctrl/Room2/Vanes"
current_temperature_topic: "MHI-AC-Ctrl/Room2/Troom"

Beste regards,

Allard

@Allinijhof
Copy link

By creating unique HOSTNAME's and PREFIX'es MQTT has been able to divide the messages. The issue has been resolved and I am now able to control my three AC's through Home Assistant. Many thanks for your help!

@glsf91
Copy link
Collaborator

glsf91 commented Nov 27, 2023

I added this issue in the Integration examples list for as Home Assistant.
As it is solved I will close this item.

@glsf91 glsf91 closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

10 participants