Haier AC with MQTT and nodered ?

For heating/cooling related questions in Domoticz

Moderator: leecollings

eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Haier AC with MQTT and nodered ?

Post by eddieb »

How can I translate a MQTT message to be used by domotiz/in for example with nodered ?
@waaren suggests that @FireWizard might be able to help ...

My Haier AC sends the following messages (in MQTT explorer)
Screenshot 2020-07-21 at 20.06.16.png
Screenshot 2020-07-21 at 20.06.16.png (74.82 KiB) Viewed 2822 times
I can also publish commands to it and it will respond.

any suggestions ?

Eddie
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by waaren »

eddieb wrote: Wednesday 22 July 2020 8:04 How can I translate a MQTT message to be used by domoticz/in ?
What do you see when you have this command active on the CLI of your PI when the Haier AC sends something via MQTT?

Code: Select all

mosquitto_sub -F "%U - %t - %p" -v -p 1883 -t "#" 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

Hi Eddie,

@eddieb
@waaren suggests that @FireWizard might be able to help ...
Sure, at least, we can try :)

Can you confirm the following:

1. Your Haier AC publishes information under the following topic "myhome/topic/Compressor", etc.
This means 9 messages (msg). Do you want to have them all in Domoticz?
I don't think RAW is very useful

If so, what are the values that each messages publishes?

2. Commands from Domoticz to the Haier AC are published under e.g. "myhome/topic/set/Set_Temp"
As I'm not sure that the screenshot is complete, can you inform me about the command to be sent?
I see only Set_Temp and Swing, but there is probably more

If I know this information, we can decide how many and the type of virtual devices, we have to create.
The construction of the flow will not be that difficult.

Before we start, it would be nice, if you test the following flow:

Screenshot_Haier_AC1.png
Screenshot_Haier_AC1.png (6.93 KiB) Viewed 2806 times
It should give for all topics an output similar to:

Screenshot_Haier_AC2.png
Screenshot_Haier_AC2.png (5.33 KiB) Viewed 2806 times
Could you publish a screenshot of published topics?

The complete test flow, you will find below:

Code: Select all

[{"id":"ebd8883c.41f248","type":"mqtt in","z":"582ecf89.8354","name":"","topic":"myhome/topic/#","qos":"0","datatype":"json","broker":"f9f13036.e28b58","x":200,"y":180,"wires":[["c3990ced.aa04c8"]]},{"id":"c3990ced.aa04c8","type":"debug","z":"582ecf89.8354","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":180,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","z":"","name":"RPI1_ MQTT_Broker","broker":"192.168.10.51","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Looking forward to the results,

Regards
Last edited by FireWizard on Thursday 23 July 2020 9:00, edited 1 time in total.
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

Hi @FireWizard

first of all, I am a total node-red newbie ... I just installed node-red on the rpi running domoticz this morning.
Looks like it is running but I don't see any output.
Screenshot 2020-07-22 at 15.02.55.png
Screenshot 2020-07-22 at 15.02.55.png (67.64 KiB) Viewed 2800 times

Code: Select all

These topics are used to send control commands to the module.
● myhome / topic / set / RAW
● myhome / topic / set / Lock_Remote​- locking the remote control buttons (1 - on - true / 0 - off - false)
● myhome / topic / set / Power​- turning on / off the air conditioner (1 - on - true / 0 - off - false)
● myhome/topic/set/Swing​-settingthepositionoftheairflowdirectioncurtains(0-off/1-ud/2-lr/3-
all)
off - disable the movement, ud - move the curtains up / down , lr - left / right movement, all - up / down and left / right
● myhome/topic/set/Fan_Speed​-fanspeedsetting(0-max/1-mid/2-min/3-auto)
● myhome/topic/set/Mode​-settingtheoperatingmode(0-auto-smart/1-cool/2-heat/3-fan_only-
vent / 4 - dry / 5 - off)
auto - automatic mode of the air conditioner, cool - cooling mode, heat - heating mode, fan_only - fan only mode, dry - air dehumidification mode, off - off.
● myhome / topic / set / Set_Temp​- temperature setting from 16 to 30 С)
● myhome/topic/set/Health-​Enablingthe"Health"mode(UVlamp)(1-on-true/0-off-false)
Topics with current states the air conditioner uses the following:
● myhome / topic / Fresh​- fresh air mode on / off
● myhome / topic / Lock_Remote​- lock the remote control true / false
● myhome / topic / Power​- power state on / off
● myhome / topic / Compressor​- compressor on / off
● myhome / topic / Swing​- air flow direction mode off / ud / lr / all
● myhome / topic / Fan_Speed​- fan speed max / mid / min / auto
● myhome / topic / Set_Temp​- set temperature
● myhome / topic / Current_Temp​- current room temperature
● myhome / topic / Mode​- air conditioner operation mode auto / cool / heat / fan_only / dry / off
● myhome / topic / Health -​​"​Health" mode (UV lamp) on / off
this is from the documentation and is all working in mqtt-explorer.

first I need some help in getting the node-red output for you ...
Eddie
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

I noticed that changing the topic in /# gets me lots of messages in the debug window, so something is working. It is just that myhome/# gives nothing ...
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

triggering on/off gives a bit of output

Code: Select all

7/22/2020, 3:29:42 PMnode: 8e8216e6.72e318
myhome/topic/Fresh : msg.payload : string[3]
"off"
7/22/2020, 3:29:42 PMnode: 8e8216e6.72e318myhome/topic/Lock_Remote : msg.payload : string[5]
"false"
7/22/2020, 3:29:43 PMnode: 8e8216e6.72e318myhome/topic/Power : msg.payload : string[2]
"on"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Health : msg.payload : string[3]
"off"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Compressor : msg.payload : string[3]
"off"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Swing : msg.payload : string[2]
"ud"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Fan_Speed : msg.payload : string[4]
"auto"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Set_Temp : msg.payload : string[2]
"19"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Current_Temp : msg.payload : string[2]
"21"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/Mode : msg.payload : string[3]
"dry"
7/22/2020, 3:29:44 PMnode: 8e8216e6.72e318myhome/topic/RAW : msg.payload : string[74]
"FFFF22000000000001026D0100150033007F00000000000400030001000100000000000366"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Fresh : msg.payload : string[3]
"off"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Lock_Remote : msg.payload : string[5]
"false"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Power : msg.payload : string[2]
"on"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Health : msg.payload : string[3]
"off"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Compressor : msg.payload : string[2]
"on"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Swing : msg.payload : string[2]
"ud"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Fan_Speed : msg.payload : string[4]
"auto"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Set_Temp : msg.payload : string[2]
"19"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Current_Temp : msg.payload : string[2]
"20"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/Mode : msg.payload : string[3]
"dry"
7/22/2020, 3:32:52 PMnode: 8e8216e6.72e318myhome/topic/RAW : msg.payload : string[74]
"FFFF22000000000001026D0100140033007F00000000000400030001001100000000000375"
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

Seems that the Haier AC does not send MQTT if it is off, so turning it on (by sending a publish ...) starts transmitting info
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

Hello Eddie,
@eddieb

So you receive the various topics from The Haier AC and the example of 12:29 works also?

Regards
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

yes @FireWizard, it seems to work, just changed the output from parsed json into automatic. Parsed json gives an eror

Code: Select all

[
    {
        "id": "d7569131.bcfd18",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "774e7dd.815f604",
        "type": "mqtt in",
        "z": "d7569131.bcfd18",
        "name": "",
        "topic": "myhome/topic/#",
        "qos": "0",
        "datatype": "auto",
        "broker": "974a4d.55b57db",
        "x": 140,
        "y": 320,
        "wires": [
            [
                "8e8216e6.72e318"
            ]
        ]
    },
    {
        "id": "8e8216e6.72e318",
        "type": "debug",
        "z": "d7569131.bcfd18",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 410,
        "y": 320,
        "wires": []
    },
    {
        "id": "974a4d.55b57db",
        "type": "mqtt-broker",
        "z": "",
        "name": "localhost",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

@eddieb

Hello Eddie

You wrote:
it seems to work, just changed the output from parsed json into automatic. Parsed json gives an eror
I can imagine, in the beginning I was unsure about the type of data, but I saw that the Haier returned only strings.

So, as you have communication between de Haier AC and Node Red, it is time to create our flows (streams).

I suggest you read this topic: https://www.domoticz.com/forum/viewtopi ... i&start=40

As this user had no MQTT interface available, we had to create first a running script to push the data to Mosquitto.
The, for you, interesting part starts about half way page 3. It will give you a quick impression, what I suggest to make.
Unfortunately the user disappeared from the forum, so I never got a final answer, that everything functioned. Pitty.

I suggest that we start with the data from the Haier AC to Domoticz.

Therefore you have to create several virtual devices

1. So create new "Hardware". Give it a name, e.g. Haier. The type is "Dummy (Does nothing, use for virtual switches only)".
2. Push "Create Virtual Sensors".

3 The first device is "myhome/topic/Fresh". I do not see a possibility to operate this, so I assume it is a sensor.
I think you can use either an "Alert" sensor or a "Text" sensor. An "On/Off" type switch is also an option, but in that case I would protect the switch.

4. Next device is "myhome/topic/Lock_Remote". This is just a type "Switch", Type "On/Off".
We will also use this "sensor"to control the Haier AC.
However, you have to decide, whether Domoticz can exclude the remote, or not.

5. Next device is myhome/topic/Power. This is just a type "Switch", Type "On/Off".
We will also use this "sensor"to control the Haier AC.

6.Next device is myhome/topic/Health. This is just a type "Switch", Type "On/Off".
We will also use this "sensor"to control the Haier AC.

7. Next device is myhome/topic/Compressor. I do not see a possibility to operate this, so I assume it is a sensor.
I think you can use either an "Alert" sensor or a "Text" sensor. An "On/Off" type switch is also an option, but in that case I would protect the switch.

8. Next device is myhome/topic/Swing. This is a type "Selector Switch"
You can see it in the other link. Configure 4 switches, called off|ud|lr|all

9. Next device is myhome/topic/Fan_Speed. This is a type "Selector Switch"
You can see it in the other link. Configure 4 switches, called max|mid|min|auto

10. Next device is myhome/topic/Set_Temp. This is a type "Thermostat Setpoint"

11. Next device is myhome/topic/Current_Temp. This is a type "Temperature".

12. Last one is myhome/topic/Mode. his is a type "Selector Switch"
Configure 6 switches, called auto|cool|heat|fan_only|dry|off

The last published topic myhome/topic/RAW is not so useful, unless you want something to do with the data.

Did I forgot anything?

Let me know.

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

Hello Eddie

Please find below a screenshot, in order to give you an impression.

Screenshot_Haier_AC3.png
Screenshot_Haier_AC3.png (153.1 KiB) Viewed 2762 times
Regards
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

Hi,

@FireWizard, I created the dummy devices ...
Screenshot 2020-07-22 at 21.15.54.png
Screenshot 2020-07-22 at 21.15.54.png (309.64 KiB) Viewed 2758 times
Screenshot 2020-07-22 at 21.16.12.png
Screenshot 2020-07-22 at 21.16.12.png (393 KiB) Viewed 2758 times
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

@eddieb.

Hello Eddie,

I have just a question. It has nothing to do with this topic, but I want to check, if the following is a bug.

In the selector switch, I have changed the icons. In your case, it are all lamps.
Can you change it to the "Generic On/Off switch ? And other icons?

Let me know, before I post on Github

Thanks in advance

The name of the virtual devices is not important and I will first prepare a stream from Haier to Domoticz.
If this works, we prepare the other way.

Regards
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

@FireWizard
something like this ?
Screenshot 2020-07-22 at 22.37.06.png
Screenshot 2020-07-22 at 22.37.06.png (330.41 KiB) Viewed 2745 times
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

@eddieb

Hello Eddie,

I thought that I saw something strange, but this is not the case, so no bug.
Thank you for confirming

The icons you want to use is up to you.

Probably tomorrow the first stream to test is finished

Regards
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

@FireWizard

I am ready for it 8-)
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

@eddieb

Hi Eddie,

I would say: "Here it is".

Can you try/test both streams.

Screenshot_Haier_AC4.png
Screenshot_Haier_AC4.png (63.48 KiB) Viewed 2656 times
The top stream is from the Haier AC to Domoticz.

1. You can remove the (green) debug node, if you are satisfied.
2. You have to edit the Function node, called "To Domoticz" and to replace my IDX numbers for your Domoticz IDX numbers

Code: Select all

switch (msg.topic) {

    case "myhome/topic/Fresh":
        msg.payload = {"command":"switchlight","idx":25,"switchcmd":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};
    break;
    
    case "myhome/topic/Lock_Remote":
        if (msg.payload == "true") {
            msg.payload = {"command":"switchlight","idx":26,"switchcmd":"On"};
        } else if (msg.payload == "false") {
            msg.payload = {"command":"switchlight","idx":26,"switchcmd":"Off"};
        }
    break;
    
    case "myhome/topic/Power":
        msg.payload = {"command":"switchlight","idx":27,"switchcmd":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};
    break;
    
    case "myhome/topic/Health":
        msg.payload = {"command":"switchlight","idx":28,"switchcmd":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};
    break;
    
    case "myhome/topic/Compressor":
        msg.payload = {"command":"switchlight","idx":29,"switchcmd":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};
    break;
    
    case "myhome/topic/Swing":    
    
        switch (msg.payload) {

            case "off":
                msg.payload = {"command":"udevice","idx":30,"nvalue":1,"svalue":"0"};
            break;
            
            case "ud":
                msg.payload = {"command":"udevice","idx":30,"nvalue":1,"svalue":"10"};
            break;

            case "lr":
                msg.payload = {"command":"udevice","idx":30,"nvalue":1,"svalue":"20"};
            break;

            case "all":
                msg.payload = {"command":"udevice","idx":30,"nvalue":1,"svalue":"30"};
            break;

        }
    break;
    
    case "myhome/topic/Fan_Speed":    
    
        switch (msg.payload) {

            case "max":
                msg.payload = {"command":"udevice","idx":31,"nvalue":1,"svalue":"10"};
            break;
            
            case "mid":
                msg.payload = {"command":"udevice","idx":31,"nvalue":1,"svalue":"20"};
            break;

            case "min":
                msg.payload = {"command":"udevice","idx":31,"nvalue":1,"svalue":"30"};
            break;

            case "auto":
                msg.payload = {"command":"udevice","idx":31,"nvalue":1,"svalue":"40"};
            break;

        }
    break;
    
    case "myhome/topic/Mode":    
    
        switch (msg.payload) {

            case "off":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"0"};
            break;
            
            case "dry":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"10"};
            break;

            case "fan_only":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"20"};
            break;

            case "heat":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"30"};
            break;

            case "cool":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"40"};
            break;

            case "auto":
                msg.payload = {"command":"udevice","idx":34,"nvalue":1,"svalue":"50"};
            break;

        }
    break;
    
    case "myhome/topic/Set_Temp":
        msg.payload = {"command":"udevice","idx":32,"nvalue":0,"svalue":msg.payload};
    break;  
    
    case "myhome/topic/Current_Temp":
        msg.payload = {"command":"udevice","idx":33,"nvalue":0,"svalue":msg.payload};
    break;
    
}

return msg;
Replace all occurrences of idx (My numbers are from 25 - 34).
Note, that the "Selector Switch", called "Haier Fan Speed" does not have an "Off" position and so start at level 10.
Click the checkbox to hide the "Off" position.

Screenshot_Haier_AC5.png
Screenshot_Haier_AC5.png (174.25 KiB) Viewed 2656 times
The lower stream is from Domoticz to Haier.

1. You have to edit the Switch node, called "Filter Haier Commands" and to replace my IDX numbers for your Domoticz IDX numbers.

A general thing to remember is that Haier publishes the data under e.g the topic myhome/topic/Set_Temp while Domoticz published e.g. under
myhome/topic/set/Set_Temp. As we have configured the MQTT input node to read everything under myhome/topic/#, it means that we also receive the published messages from Domoticz. It is a different topic and should not influence the function.

Looking forward for your results.

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

@eddieb

Hereby the flow:

Code: Select all

[{"id":"ebd8883c.41f248","type":"mqtt in","z":"582ecf89.8354","name":"","topic":"myhome/topic/#","qos":"0","datatype":"auto","broker":"f9f13036.e28b58","x":200,"y":180,"wires":[["fce00daf.a46d3"]]},{"id":"c3990ced.aa04c8","type":"debug","z":"582ecf89.8354","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":120,"wires":[]},{"id":"fce00daf.a46d3","type":"function","z":"582ecf89.8354","name":"To Domoticz","func":"switch (msg.topic) {\n\n    case \"myhome/topic/Fresh\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":25,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Lock_Remote\":\n        if (msg.payload == \"true\") {\n            msg.payload = {\"command\":\"switchlight\",\"idx\":26,\"switchcmd\":\"On\"};\n        } else if (msg.payload == \"false\") {\n            msg.payload = {\"command\":\"switchlight\",\"idx\":26,\"switchcmd\":\"Off\"};\n        }\n    break;\n    \n    case \"myhome/topic/Power\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":27,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Health\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":28,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Compressor\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":29,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Swing\":    \n    \n        switch (msg.payload) {\n\n            case \"off\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":30,\"nvalue\":1,\"svalue\":\"0\"};\n            break;\n            \n            case \"ud\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":30,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n\n            case \"lr\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":30,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"all\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":30,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Fan_Speed\":    \n    \n        switch (msg.payload) {\n\n            case \"max\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":31,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n            \n            case \"mid\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":31,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"min\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":31,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n            case \"auto\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":31,\"nvalue\":1,\"svalue\":\"40\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Mode\":    \n    \n        switch (msg.payload) {\n\n            case \"off\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"0\"};\n            break;\n            \n            case \"dry\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n\n            case \"fan_only\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"heat\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n            case \"cool\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"40\"};\n            break;\n\n            case \"auto\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":34,\"nvalue\":1,\"svalue\":\"50\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Set_Temp\":\n        msg.payload = {\"command\":\"udevice\",\"idx\":32,\"nvalue\":0,\"svalue\":msg.payload};\n    break;  \n    \n    case \"myhome/topic/Current_Temp\":\n        msg.payload = {\"command\":\"udevice\",\"idx\":33,\"nvalue\":0,\"svalue\":msg.payload};\n    break;\n    \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":180,"wires":[["c3990ced.aa04c8","90270661.710f2"]]},{"id":"90270661.710f2","type":"mqtt out","z":"582ecf89.8354","name":"","topic":"domoticz/in","qos":"0","retain":"false","broker":"f9f13036.e28b58","x":610,"y":180,"wires":[]},{"id":"64b5eaa0.13288c","type":"mqtt in","z":"582ecf89.8354","name":"","topic":"domoticz/out","qos":"2","datatype":"json","broker":"c8ffac2.b82d7d","x":190,"y":340,"wires":[["2c46664a.825c42"]]},{"id":"2c46664a.825c42","type":"switch","z":"582ecf89.8354","name":"Filter Haier Commands","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"26","vt":"num"},{"t":"eq","v":"27","vt":"num"},{"t":"eq","v":"28","vt":"num"},{"t":"eq","v":"30","vt":"num"},{"t":"eq","v":"31","vt":"num"},{"t":"eq","v":"34","vt":"num"},{"t":"eq","v":"32","vt":"num"}],"checkall":"true","repair":false,"outputs":7,"x":430,"y":340,"wires":[["1e222f4f.2ae321"],["b71601fa.090298"],["b5b4bde0.2a31d8"],["9a6d2fbc.7ad4a8"],["c3a67827.0c47b8"],["731e5517.b0048c"],["a9678a88.e40df"]]},{"id":"3a670b2a.08dc24","type":"comment","z":"582ecf89.8354","name":"Output explanation","info":"1. Lock Remote\n2. Power\n3. Health\n4. Swing\n5. Fan Speed\n6. Mode\n7. Thermostat Setpoint","x":410,"y":440,"wires":[]},{"id":"1e222f4f.2ae321","type":"function","z":"582ecf89.8354","name":"Lock Remote","func":"msg.topic = \"myhome/topic/set/Lock_Remote\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":700,"y":240,"wires":[["d34fc9f1.50312"]]},{"id":"b71601fa.090298","type":"function","z":"582ecf89.8354","name":"Power","func":"msg.topic = \"myhome/topic/set/Power\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":280,"wires":[["d34fc9f1.50312"]]},{"id":"b5b4bde0.2a31d8","type":"function","z":"582ecf89.8354","name":"Health","func":"msg.topic = \"myhome/topic/set/Health\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":320,"wires":[["d34fc9f1.50312"]]},{"id":"9a6d2fbc.7ad4a8","type":"function","z":"582ecf89.8354","name":"Swing","func":"msg.topic = \"myhome/topic/set/Swing\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n        msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"ud\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"lr\";\n        break;\n\n        case \"30\":\n            msg.payload = \"all\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":360,"wires":[["d34fc9f1.50312"]]},{"id":"c3a67827.0c47b8","type":"function","z":"582ecf89.8354","name":"Fan Speed","func":"msg.topic = \"myhome/topic/set/Fan_Speed\";\nif (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"max\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"mid\";\n        break;\n\n        case \"30\":\n            msg.payload = \"min\";\n        break;\n\n        case \"40\":\n            msg.payload = \"auto\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":400,"wires":[["d34fc9f1.50312"]]},{"id":"731e5517.b0048c","type":"function","z":"582ecf89.8354","name":"Mode","func":"msg.topic = \"myhome/topic/set/Mode\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n        msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"dry\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"fan_only\";\n        break;\n\n        case \"30\":\n            msg.payload = \"heat\";\n        break;\n        \n        case \"40\":\n            msg.payload = \"cool\";\n        break;\n\n        case \"50\":\n            msg.payload = \"auto\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":670,"y":440,"wires":[["d34fc9f1.50312"]]},{"id":"a9678a88.e40df","type":"function","z":"582ecf89.8354","name":"Set Temperature","func":"msg.topic = \"myhome/topic/set/Set_Temp\";\nmsg.payload = msg.payload.svalue1;\nif (Number(msg.payload) < 16) (msg.payload) = \"16.00\";\nif (Number(msg.payload) > 30) (msg.payload) = \"30.00\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":710,"y":480,"wires":[["d34fc9f1.50312"]]},{"id":"d34fc9f1.50312","type":"mqtt out","z":"582ecf89.8354","name":"MQTT to Haier","topic":"","qos":"0","retain":"false","broker":"f9f13036.e28b58","x":1000,"y":340,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","z":"","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"c8ffac2.b82d7d","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Regards
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Haier AC with MQTT and nodered ?

Post by eddieb »

@FireWizard

tnx so far.
something is working ...
for now it looks like only the mode is not working ... in both directions ...
I will look into it tomorrow when I have a bit more time to test.

Code: Select all

[{"id":"f8735c63.2bce68","type":"mqtt in","z":"368ce178.20b30e","name":"","topic":"myhome/topic/#","qos":"0","datatype":"auto","broker":"2cb31592.9db462","x":160,"y":260,"wires":[["eb4e19ba.25f958"]]},{"id":"6cbef17.484a91","type":"debug","z":"368ce178.20b30e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":200,"wires":[]},{"id":"eb4e19ba.25f958","type":"function","z":"368ce178.20b30e","name":"To Domoticz","func":"switch (msg.topic) {\n\n    case \"myhome/topic/Fresh\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":246,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Lock_Remote\":\n        if (msg.payload == \"true\") {\n            msg.payload = {\"command\":\"switchlight\",\"idx\":247,\"switchcmd\":\"On\"};\n        } else if (msg.payload == \"false\") {\n            msg.payload = {\"command\":\"switchlight\",\"idx\":247,\"switchcmd\":\"Off\"};\n        }\n    break;\n    \n    case \"myhome/topic/Power\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":248,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Health\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":249,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Compressor\":\n        msg.payload = {\"command\":\"switchlight\",\"idx\":250,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n    break;\n    \n    case \"myhome/topic/Swing\":    \n    \n        switch (msg.payload) {\n\n            case \"off\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"0\"};\n            break;\n            \n            case \"ud\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n\n            case \"lr\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"all\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Fan_Speed\":    \n    \n        switch (msg.payload) {\n\n            case \"max\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n            \n            case \"mid\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"min\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n            case \"auto\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"40\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Mode\":    \n    \n        switch (msg.payload) {\n\n            case \"off\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"0\"};\n            break;\n            \n            case \"dry\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n\n            case \"fan_only\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"heat\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n            case \"cool\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"40\"};\n            break;\n\n            case \"auto\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"50\"};\n            break;\n\n        }\n    break;\n    \n    case \"myhome/topic/Set_Temp\":\n        msg.payload = {\"command\":\"udevice\",\"idx\":253,\"nvalue\":0,\"svalue\":msg.payload};\n    break;  \n    \n    case \"myhome/topic/Current_Temp\":\n        msg.payload = {\"command\":\"udevice\",\"idx\":254,\"nvalue\":0,\"svalue\":msg.payload};\n    break;\n    \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":260,"wires":[["6cbef17.484a91","50b3a84a.5006c8"]]},{"id":"50b3a84a.5006c8","type":"mqtt out","z":"368ce178.20b30e","name":"","topic":"domoticz/in","qos":"0","retain":"false","broker":"2cb31592.9db462","x":570,"y":260,"wires":[]},{"id":"4996743f.5b86c4","type":"mqtt in","z":"368ce178.20b30e","name":"","topic":"domoticz/out","qos":"2","datatype":"json","broker":"183fcf3a.ecc671","x":150,"y":420,"wires":[["a33fe4a5.8e401"]]},{"id":"a33fe4a5.8e401","type":"switch","z":"368ce178.20b30e","name":"Filter Haier Commands","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"247","vt":"num"},{"t":"eq","v":"248","vt":"num"},{"t":"eq","v":"249","vt":"num"},{"t":"eq","v":"251","vt":"num"},{"t":"eq","v":"252","vt":"num"},{"t":"eq","v":"254","vt":"num"},{"t":"eq","v":"255","vt":"num"}],"checkall":"true","repair":false,"outputs":7,"x":390,"y":420,"wires":[["2defd0dd.92e31"],["2634997.53e41e6"],["6306c0e2.ef5d68"],["2d4fea47.dddd56"],["bbd2e04a.11a628"],["aebe0539.a29f8"],["2ac9aaf1.d3387e"]]},{"id":"7b3b385e.d39d5","type":"comment","z":"368ce178.20b30e","name":"Output explanation","info":"1. Lock Remote\n2. Power\n3. Health\n4. Swing\n5. Fan Speed\n6. Mode\n7. Thermostat Setpoint","x":370,"y":520,"wires":[]},{"id":"2defd0dd.92e31","type":"function","z":"368ce178.20b30e","name":"Lock Remote","func":"msg.topic = \"myhome/topic/set/Lock_Remote\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":320,"wires":[["1d8d5884.6d6edf"]]},{"id":"2634997.53e41e6","type":"function","z":"368ce178.20b30e","name":"Power","func":"msg.topic = \"myhome/topic/set/Power\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":360,"wires":[["1d8d5884.6d6edf"]]},{"id":"6306c0e2.ef5d68","type":"function","z":"368ce178.20b30e","name":"Health","func":"msg.topic = \"myhome/topic/set/Health\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":400,"wires":[["1d8d5884.6d6edf"]]},{"id":"2d4fea47.dddd56","type":"function","z":"368ce178.20b30e","name":"Swing","func":"msg.topic = \"myhome/topic/set/Swing\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n        msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"ud\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"lr\";\n        break;\n\n        case \"30\":\n            msg.payload = \"all\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":440,"wires":[["1d8d5884.6d6edf"]]},{"id":"bbd2e04a.11a628","type":"function","z":"368ce178.20b30e","name":"Fan Speed","func":"msg.topic = \"myhome/topic/set/Fan_Speed\";\nif (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"max\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"mid\";\n        break;\n\n        case \"30\":\n            msg.payload = \"min\";\n        break;\n\n        case \"40\":\n            msg.payload = \"auto\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":480,"wires":[["1d8d5884.6d6edf"]]},{"id":"aebe0539.a29f8","type":"function","z":"368ce178.20b30e","name":"Mode","func":"msg.topic = \"myhome/topic/set/Mode\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n        msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n    switch (msg.payload.svalue1) {\n        case \"10\":\n            msg.payload = \"dry\";\n        break;\n        \n        case \"20\":\n            msg.payload = \"fan_only\";\n        break;\n\n        case \"30\":\n            msg.payload = \"heat\";\n        break;\n        \n        case \"40\":\n            msg.payload = \"cool\";\n        break;\n\n        case \"50\":\n            msg.payload = \"auto\";\n        break;\n\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":520,"wires":[["1d8d5884.6d6edf"]]},{"id":"2ac9aaf1.d3387e","type":"function","z":"368ce178.20b30e","name":"Set Temperature","func":"msg.topic = \"myhome/topic/set/Set_Temp\";\nmsg.payload = msg.payload.svalue1;\nif (Number(msg.payload) < 16) (msg.payload) = \"16.00\";\nif (Number(msg.payload) > 30) (msg.payload) = \"30.00\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":560,"wires":[["1d8d5884.6d6edf"]]},{"id":"1d8d5884.6d6edf","type":"mqtt out","z":"368ce178.20b30e","name":"MQTT to Haier","topic":"","qos":"0","retain":"false","broker":"2cb31592.9db462","x":960,"y":420,"wires":[]},{"id":"2cb31592.9db462","type":"mqtt-broker","z":"","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"183fcf3a.ecc671","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
is what I loaded now.

Eddie
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Haier AC with MQTT and nodered ?

Post by FireWizard »

Hello Eddie
@eddieb

I looked into your changes and found some errors.

In the Function node,"To Domoticz", you use:

1. For Mode: idx = 255
2. For Set_Temp: idx = 253

In the Switch node, "Filter Haier Commands", you use:

1. For Mode: idx = 254
2. For Set_Temp: idx = 255

As it is one and the same device, either the first one, or the second one is wrong.
Something to check!

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest