Haier AC with MQTT and nodered ?

For heating/cooling related questions in Domoticz

Moderator: leecollings

User avatar
FireWizard
Posts: 1886
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

Okay, we leave it, as it is.

Anything else? If not I will clean my test sytem.

Regards
eddieb
Posts: 335
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

no, not for now. You may cleanup.
have it running and it is in my daily backup so it won't get lost.

tnx again for you effort and time.
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: 335
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 »

@Waaren You asked for :

Code: Select all

mosquitto_sub -F "%U - %t - %p" -v -p 1883 -t "#" | grep myhome
1596091230.892980169 - myhome/topic/set/Set_Temp - 16.00
1596091231.173870918 - myhome/topic/Fresh - off
1596091231.222781865 - myhome/topic/Lock_Remote - false
1596091231.223082957 - myhome/topic/Power - off
1596091231.223199728 - myhome/topic/Health - off
1596091231.223286290 - myhome/topic/Compressor - off
1596091231.223368894 - myhome/topic/Swing - off
1596091231.223450039 - myhome/topic/Fan_Speed - auto
1596091231.223530351 - myhome/topic/Set_Temp - 16
1596091231.223621757 - myhome/topic/Current_Temp - 19
1596091231.223703788 - myhome/topic/Mode - off
1596091231.223790662 - myhome/topic/RAW - FFFF22000000000001026D010013002F007F00000000000100030000000000000000000058
1596091232.005519471 - myhome/topic/set/Set_Temp - 16.00
@FireWizard
as you see :
Domoticz sends a set/Set_Temp
device answers with the changed status including the new Set_Temp
Domoticz than sends the set/Set_Temp again ...

that last one is not neccesary and makes the AC unit beep a second time.
Is there a way to suppress the second time ?

btw, this happens for most commands send by domoticz to the unit ...
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: 1886
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,

How is your MQTT hardware device configured?

Check that "Prevent Loop" is set to "True" in order to prevent, that received commands are send back.
Your Domoticz version should be at least V4.11921

See: https://www.domoticz.com/wiki/Previous_ ... z_versions

Screenshot_MQTT loop.png
Screenshot_MQTT loop.png (29.8 KiB) Viewed 1565 times

Let me know, otherwise I have to check the flow.

Regards
eddieb
Posts: 335
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
Hi,

where do I find this "prevent loop" I do not see that option ...
I am running 2020.2 build 12230 on the beta channel on rpi.

In the mean time I have received firmware 3.0.4 from installator with some bugfixes and a new command implemented ...
I will implement that new command "Lights on/off" to dim the LED on the AC unit myself.
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: 1886
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

If you go to Setup > Hardware, and then select your MQTT device, you should see it.

Regards
eddieb
Posts: 335
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, I was looking in the wrong place ..
It was there and correct ...
Screenshot 2020-07-30 at 13.03.16.png
Screenshot 2020-07-30 at 13.03.16.png (268.08 KiB) Viewed 1551 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: 1886
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 was there and correct ...
What currently is unclear for me, whether this setting was "False" and changing it to "True" solved your issue, or was the setting "True" and so the issue still exist. In that case we have to look to the flow again.
In the mean time I have received firmware 3.0.4 from installator with some bug fixes and a new command implemented ...
I will implement that new command "Lights on/off" to dim the LED on the AC unit myself.
If you need support to implement a dimmer, let me know.

Regards
eddieb
Posts: 335
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
FireWizard wrote: Thursday 30 July 2020 17:03
It was there and correct ...
What currently is unclear for me, whether this setting was "False" and changing it to "True" solved your issue, or was the setting "True" and so the issue still exist. In that case we have to look to the flow again.
Sorry if I was unclear. I did NOT change the setting, it was "true" for ages ...
If you can, please look into the flow again.
If you need support to implement a dimmer, let me know.
Dimming the LED on the AC unit is a single switch, I think I can do that myself 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: 1886
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

You wrote:
as you see :
Domoticz sends a set/Set_Temp
device answers with the changed status including the new Set_Temp
Domoticz than sends the set/Set_Temp again ...

that last one is not neccesary and makes the AC unit beep a second time.
Is there a way to suppress the second time ?

btw, this happens for most commands send by domoticz to the unit ...
Actually, it is not the device that answers, but the sending topic (myhome/topic/set/Set_Temp) is picked-up by the MQTT input node and is in fact injected again. I think the solution is very simple.

Change the topic in the MQTT input node, now marked myhome/topic/#, into myhome/topic/+. So change # to +.

Test it again en let me know.

Regards
eddieb
Posts: 335
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

Hi

I chaged the # in + and the result is not what you said
Screenshot 2020-07-30 at 21.26.02.png
Screenshot 2020-07-30 at 21.26.02.png (250.26 KiB) Viewed 1512 times
this is a complete message received.
the Set_Temp is done outside Domoticz.
Domoticz noticed that and sent a set/Set_Temp ...
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: 1886
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, not okay.

The problem is that I do not have a device. But I will look into it with a simulation.

You also mentioned:
btw, this happens for most commands send by domoticz to the unit ...
What do they do?

Regards
eddieb
Posts: 335
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

some device sends a /set/ command to the unit thru MQTT

that /set/ is seen by domoticz (but not created by domoticz).
the unit accepts this /set/ with a BEEP and
replies with the complete new mqtt status and domoticz uses that
after that domoticz sends a new /set/ command with the same content as the initial one.
The unit ignores that second one with a BEEP ... (so I hear 2 BEEPs) ...

this is for all /set/ commands
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: 1886
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
some device sends a /set/ command to the unit thru MQTT
Which devices?
that /set/ is seen by domoticz (but not created by domoticz)
Should not be, with the changed topic.

Is that correct. Personally I think, that the unit should not publish anything in topic myhome/topic/set/Set_Temp and others with set.
That should be reserved for the third party. The unit should only publish in topic myhome/topic/Set_Temp, etc.

I have to sort it out, but if you look, you will see that the "Set_Temp" is published in myhome/topic/Set_temp with a payload 17.
The myhome/topic/set/Set_temp shows a payload 17.00

Is the picture, that you showed, made in the old situation (so with #) or in the new situation (so with +)?

Regards
eddieb
Posts: 335
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
It is not the unit but the "web Application" in the USB-ESP which is running on tcp/80.
Screenshot 2020-07-30 at 22.13.43.png
Screenshot 2020-07-30 at 22.13.43.png (116.87 KiB) Viewed 1508 times
This page makes it possible to control the unit. It sends MQTT status after each change but NO /set/ commands

That status is parsed into domoticz and domoticz sees that some value is changed. (Set_Temp in domoticz was 18, is now 19)
Domoticz adjusts its value and because the value changed domoticz sends a /set/ with the new value ...

the picture is taken with the new +

this might be a chicken/egg problem and not solvable
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: 1886
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

In the meantime I did a lot of testing, but I concentrated on the Set_Temp.

I found the following:

1. If I send a new Temperature on myhome/topic/Set_Temp, Node Red sends the correct command to Domoticz and the temperature of the Thermostat sensor is nicely changed. So far, so good. The Domoticz thermostat should give the same temperature as the external USB-ESP.

But in addition it returns the same Setpoint and, of course Node Red publishes this Setpoint to myhome/topics/set/Set_Temp

See:
Screenshot_Haier_AC6.png
Screenshot_Haier_AC6.png (32.93 KiB) Viewed 1508 times

At the top you see the command to domoticz/in.
In the middle you see the (filtered) output from domoticz/out
The last one is what is send to myhome/topics/set/Set_Temp

This is not what we want.
Now I know, how the problem occurs and I have to think about a solution.

Regards
eddieb
Posts: 335
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 wrote: Thursday 30 July 2020 22:51 In the meantime I did a lot of testing, but I concentrated on the Set_Temp.

I found the following:

1. If I send a new Temperature on myhome/topic/Set_Temp, Node Red sends the correct command to Domoticz and the temperature of the Thermostat sensor is nicely changed. So far, so good. The Domoticz thermostat should give the same temperature as the external USB-ESP.

But in addition it returns the same Setpoint and, of course Node Red publishes this Setpoint to myhome/topics/set/Set_Temp

This is not what we want.
Now I know, how the problem occurs and I have to think about a solution.
Hi,

I think that is exactly the problem ...
I hope there is a solotion
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: 1886
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 investigated the problem and tested, beside the thermostat node, also the switch node and the selector switch, as these are the node that are used and also sends commands back to your USB-ESP.

I found that the only node that returns a command on MQTT out is the thermostat node. The other ones do not return a MQTT out command, if they receive a status update on the MQTT input.

It is not what I had expected and in my opinion the Thermostat should not return a command on MQTT out.

While testing, I also found two other bugs (the same), which has been corrected as well.

As it only applies to incoming status updates to the thermostat device, I block only thermostat outgoing commands during 250 msec, after a status update for the Thermostat device has been received.

In my case 250 msec was enough, but you might want to do some tests with different values, if necessary..

In order to use the new flow, you have to install a new node, if not done before.
To do so, go to the "Hamburger" menu and select "Manage palette". Go to "Install" and search for: "node-red-contrib-simple-gate".
Install this module.
For information, see: https://flows.nodered.org/node/node-red ... imple-gate

To understand the working, you might want to take a look at: https://www.domoticz.com/forum/viewtopi ... a&start=20
Post starting June. 2nd, 2020 14:38 I described the working of the gate.

Can you replace your existing flow with this new one, as there are the following changes:

- incoming MQTT tpic changed from myhome/topic/# into myhome/topic/+
- correction in Function node, called "To Domoticz" in lines 32 and 78 ("nvalaue":1 changed no "nvalue": 0)
- added 3 nodes to prevent MQTT loop for Thermostat node.

New flow:

Code: Select all

[{"id":"68bd7ad.9fccc84","type":"mqtt in","z":"95e506f1.1038d","name":"","topic":"myhome/topic/+","qos":"0","datatype":"auto","broker":"9136b136.ffa5a","x":200,"y":220,"wires":[["d2541dab.eb513","9ee4d50e.2de438"]]},{"id":"ca543182.bf65","type":"debug","z":"95e506f1.1038d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":160,"wires":[]},{"id":"d972de82.247a18","type":"mqtt out","z":"95e506f1.1038d","name":"","topic":"domoticz/in","qos":"0","retain":"false","broker":"9136b136.ffa5a","x":610,"y":220,"wires":[]},{"id":"ceb584c5.533378","type":"mqtt in","z":"95e506f1.1038d","name":"","topic":"domoticz/out","qos":"2","datatype":"json","broker":"9136b136.ffa5a","x":190,"y":545,"wires":[["358b0c09.08538c"]]},{"id":"358b0c09.08538c","type":"switch","z":"95e506f1.1038d","name":"Filter Haier Commands","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"253","vt":"num"},{"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":"255","vt":"num"}],"checkall":"true","repair":false,"outputs":7,"x":430,"y":545,"wires":[["feaeee49.a4a35"],["bf2ffdd0.ea5db8"],["1a75f100.5454c7"],["400d7b0a.3f83ac"],["a6a851b6.d7a12"],["8f421108.cf8ac8"],["fce8813.b2ecf"]]},{"id":"7295f34.ad2e70c","type":"comment","z":"95e506f1.1038d","name":"Output explanation","info":"1. Lock Remote\n2. Power\n3. Health\n4. Swing\n5. Fan Speed\n6. Mode\n7. Thermostat Setpoint","x":410,"y":645,"wires":[]},{"id":"bf2ffdd0.ea5db8","type":"function","z":"95e506f1.1038d","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":680,"y":440,"wires":[["e977c161.b80918"]]},{"id":"1a75f100.5454c7","type":"function","z":"95e506f1.1038d","name":"Power","func":"msg.topic = \"myhome/topic/set/Power\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":480,"wires":[["e977c161.b80918"]]},{"id":"400d7b0a.3f83ac","type":"function","z":"95e506f1.1038d","name":"Health","func":"msg.topic = \"myhome/topic/set/Health\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":520,"wires":[["e977c161.b80918"]]},{"id":"a6a851b6.d7a12","type":"function","z":"95e506f1.1038d","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":650,"y":560,"wires":[["e977c161.b80918"]]},{"id":"8f421108.cf8ac8","type":"function","z":"95e506f1.1038d","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":670,"y":600,"wires":[["e977c161.b80918"]]},{"id":"fce8813.b2ecf","type":"function","z":"95e506f1.1038d","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 = \"heat\";\n        break;\n        \n        case \"30\":\n            msg.payload = \"cool\";\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":640,"wires":[["e977c161.b80918"]]},{"id":"feaeee49.a4a35","type":"function","z":"95e506f1.1038d","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":690,"y":400,"wires":[["305bd6e2.f7e4ea"]]},{"id":"e977c161.b80918","type":"mqtt out","z":"95e506f1.1038d","name":"MQTT to Haier","topic":"","qos":"0","retain":"false","broker":"9136b136.ffa5a","x":1080,"y":540,"wires":[]},{"id":"d2541dab.eb513","type":"function","z":"95e506f1.1038d","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\":0,\"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\":0,\"svalue\":\"0\"};\n            break;\n            \n            case \"Dry\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"10\"};\n            break;\n\n            case \"Heat\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"20\"};\n            break;\n\n            case \"Cool\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"30\"};\n            break;\n\n            case \"Auto\":\n                msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"40\"};\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":410,"y":220,"wires":[["d972de82.247a18","ca543182.bf65"]]},{"id":"8f6bc3ad.da4b8","type":"comment","z":"95e506f1.1038d","name":"246 Fresh 247 Lock_Remote 248 Power 249 Health 250 Compressor 251 Swing 252 Fan_Speed 253 Set_Temp 254 Current_Temp 255 Mode","info":"246 Fresh\n247 Lock_Remote\n248 Power\n249 Health\n250 Compressor\n251 Swing\n252 Fan_Speed\n253 Set_Temp\n254 Current_Temp\n255 Mode","x":590,"y":60,"wires":[]},{"id":"b1b7bcd5.fdb2b8","type":"trigger","z":"95e506f1.1038d","name":"","op1":"","op2":"open","op1type":"pay","op2type":"str","duration":"250","extend":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":680,"y":300,"wires":[["305bd6e2.f7e4ea"]]},{"id":"305bd6e2.f7e4ea","type":"gate","z":"95e506f1.1038d","name":"Gate","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":890,"y":400,"wires":[["e977c161.b80918","52236be3.57f05c"]]},{"id":"9ee4d50e.2de438","type":"function","z":"95e506f1.1038d","name":"Create Gate Control","func":"if (msg.topic == \"myhome/topic/Set_Temp\") {\n    msg.topic = \"control\";\n    msg.payload = \"close\";\n    return [msg, null];\n} else {\n    return [null,msg]\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":300,"wires":[["b1b7bcd5.fdb2b8"]]},{"id":"52236be3.57f05c","type":"debug","z":"95e506f1.1038d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":400,"wires":[]},{"id":"9136b136.ffa5a","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","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Test it carefully and let me know.
As said, it might be necessary to play with the time in the trigger node (currently 250 msec)

Regards
eddieb
Posts: 335
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
FireWizard wrote: Saturday 01 August 2020 16:33
Test it carefully and let me know.
As said, it might be necessary to play with the time in the trigger node (currently 250 msec)

Regards
Hi,

I installed the node and implemented the new flow.
250ms was not enough for me, I still got the 2 beeps.
increasing to 500ms did not help so I increased to 1s and now it seems to work. I only get 1 beep.

I will do some more testing and let you know,
thanks so far !
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: 1886
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
250ms was not enough for me, I still got the 2 beeps.
increasing to 500ms did not help so I increased to 1s and now it seems to work. I only get 1 beep.
In the flow I have included two Debug nodes. You can easily check, whether the time is enough, or not.

As soon as you receive a status update for the "Thermostat", you should see the command, send to Domoticz, in the upper Debug node.
If the time is enough you don't see a message in the lower Debug node. If the time is too short you will see a message with the topic myhome/topic/set/Set_Temp in the lower Debug node. Another topic you should ignore.

As said, I'm not really happy with this "solution". I see it as a "work around".
I decided to discuss it with waaren and that resulted in a Pull Request.

If this PR is accepted by gizmocuz, the problem is solved in one of the next releases. In that case, you can remove those 3 extra nodes.
You can follow the progress at: https://github.com/domoticz/domoticz/issues/4282

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest