HDL Smartbus via NodeRed and MQTT

Hey team, good to see some more dev going on with this - I published the node-red module node-red-contrib-hdlbus a couple of years back (forked from node-red-contrib-buspro - that dev and I couldn’t agree on directions at the time unfortunately), haven’t had a need to update it really to date. I saw a PR pop up a few weeks back - but it’s gone now - that one of you?

I use DALI for lighting - hence why there’s a virtual DALI groups device - this is necessary to store/recall levels as they’re not reported correctly on the HDL network. Drop the node on a page and read the info pane if you’d like to understand it more - basically just makes the 16 DALI groups function as a virtual 16ch dimmer.

I use the addin slightly differently (I think?) - I have a generic flow for lights that creates a 2-way conduit between HDL and MQTT without knowing about any of the devices - then I create mqtt lights in HA YAML. I’ve recently got into autodiscovery in HA, so would love to look at being able to auto-create entities, just need to find the time.

The YAML for a light/channel - this is in the ‘light’ domain:

- platform: mqtt
  name: "Flat Hall"
  command_topic: "lights/20/1/cmd"
  state_topic: "lights/20/1/state"
  state_value_template: "{{value_json.power}}"
  on_command_type: brightness
  brightness_scale: 100
  brightness_command_topic: "lights/20/1/cmd"
  brightness_state_topic: "lights/20/1/state"
  brightness_value_template: "{{value_json.brightness}}"

I do have DLP AC control working for 2-way control also - by this I mean I’m using HA to control my AC, then interfacing with the DLP to facilitate control/display via that interface. 1.95 (in the below image) is the address I gave the aircon control in my DLP.

I did get motor controllers working too for a friend - I can dig into that if people are still looking for that.

Will keep an eye on this topic and happy to answer any questions. :+1:

1 Like

Hi Ben, nice to se you here :smiley:

I created a pull request to implement a buxfix(Current temperature was missing and also had a indexing fault towards the end) for the Heatingmodule MFH06 codes, so if you could implement the PR that would be appreciated. Are you not able to see the PR anymore? I might have deactivated it by accident or something.

I also figured out some of the undocumented codes for DLP`s (Panel Brightness, Eco Mode +++) for some reason that also made its way in to the PR(i am not to familiar with github)

I think it is the same way as i have published here on the forum. I filter the HDL messages by the different answeerback codes for lights, US, sensors thermostats etc. and send it over to the MQTT server.(Thermostats and AC are also saved to the nodered flow context data so that it can be used when changing those messages later from HA as HDL needs the whole config and not only the change for those messages)

The traffic from HA to HDL is also switched by different MQTT topics.

This makes it so that you do not have to do any changes in nodered and all changes are done in the yaml files for the HA interfacing.

That would be cool, where you planning on running only in HA then or still use nodered alongside? I have also looked at those codes slightly and planned to make a addon in HA bypassing nodered stuff but gave it up as i found the nodered route to be more easy as i dont have any HA development skills. Was in the start thinking a auto discovery addon would be great(Names for channels etc could also be taken straight from the channel remarks).

I was also one thime thinking on making a script for nodered that auto created the configuration.yaml file witch would be doable but in the end desided that individual configuration of the yaml files to be quick and good enough.

I dont have DALI but i have DMX for some led strips etc. and they operate same as normal dimmers.
I therfore tought that dali worked on the same codes as a normal dimmer or relay.

Think you forgot to add the flows, would very mutch like to see it if you would be willing to share it?

I think this is the same as i am doing now, you do not have a HDL ac module? I do not own a AC module and my Panasonic heatpump uses extra long IR codes witch is not able to be sendt from HDL. I therfore made a flow in my old openhab setup that listens for the AC command and then sends the answeerback and then forward the message to the Arduino IR sender. It also takes the commands from openhab and update the DLP`s.

When moving to HA i keept my old PI running openhab on the network and only made a flow that works by listening for the HDL answeerback message to update status on the MQTT server. Also commands from MQTT/HA are sendt the same way as a DLP sends the message. (This shold also then work for the persons running an actual HDL AC module)

I was planning on removing my old PI running the Openhab/nodered setup and use the old flow but was not able to. The message on a “HDL raw out” does not show up on a “HDL raw in” on the same nodered instance. Could you therfore also share the flow on how you use the virtual HVAC nodes so that i might be able to use some of it :smiley:

Would like to see the flows for that if you still have them.(Infact i would like to see all of your HDL flows if you are willing to share :smiley:) Do you remember if you got the % feedback from the module? The way i read the HDL docs it should also report the % status of the blinds on the messages. (Have not yet had time to check the raw Hex messages provided by @Cregeland to check if the % value is reported there but will look into it now.)

1 Like

Thanks @Cregeland

Unfortunately the motor controller does not send current state.

Went down the rabbit hole and have done some changes.

Instead of the delay timer i now save the command value and use it again when the broadcast message reports stopped to know if it the state state is open or closed. Also added position of 0%(Closed) 100%(Open) or 50%(Stopped) You should now be able to stop the blinds midway and continue with open or close.

You will have to change the cover.yaml file to something like this:

#Test blind HDL curtain controller
#
# Bedroom blinds
- platform: mqtt
  name: "Blind Bedroom"
  device_class: shade
  command_topic: "hdl/cc/1.5/1/set"
  state_topic: "hdl/cc/1.5/1/state"
  optimistic: true
  position_topic: "hdl/cc/1.5/1/position"
#
# Living Room blinds
- platform: mqtt
  name: "Blind Living Room"
  device_class: shade
  command_topic: "hdl/cc/1.5/2/set"
  state_topic: "hdl/cc/1.5/2/state"
  optimistic: true
  position_topic: "hdl/cc/1.5/2/position"

Here is the new flow.

Can you report how it works for you now?

hi
I found a new device, code 5195, which is a fresh air system
The current node cannot find this device
Through the mobile phone, I found some control codes


01 01 00 03 A4 00 41 A8 00 00 00 00 00 00 42 38 00 00 00 00 00 00 43 5F 00 00 43 EE 00 00 AE 6C
01 01 00 <-(fan speed) 03 A4 00 41 A8 00 00 00 00 00 00 42 38 00 00 00 00 00 00 43 5F 00 00 43 EE 00 00 AE 6C
00 = auto , 01 min , 02 mid , 03 max

01 01 00 03<-(mode) A4 00 41 A8 00 00 00 00 00 00 42 38 00 00 00 00 00 00 43 5F 00 00 43 EE 00 00 AE 6C

00 is ai mode
01 is manual mode
02 Internal circulation mode
03 constant temperature mode

hope update command.js
new problem
looks contrid-hdlbus can’t support devicetype
default typeid is 00 00

    "payload": {
        "opCode": 0x002,
        "sender": {
            "deviceType": 0x00B,
            "subnetId": 1,
            "deviceId": 2,
            "wasSendToThisDevice": true/false

hdlbus can’t get typeid
i use hdl setup tools , get packet like this
1A 01 33 11 B6 FF 02 FF FF 01 04 0A 12 00 41 01 00 F0 00 00 00 E9 25 85 11 AA
01 33 >>> subnet 01 device 51
11 B6 is type id , but can’t show on node-red debug tab
FF 02 is code
FF FF boardcast
and sender ip show wrong , is show 1.X
{“sender”:“1.X”,“target”:“255.255”,“code”:55876,“payload”:{“date”:“2022-05-01T10:10:02.000Z”},“topic”:“command”,"_msgid":“3bdb6b0988422f31”}

need update bus.js for show typeid , and custom type in msg.payload.typeid better

Hi @ritech

I dont think any of those codes are control codes, they are all broadcasting from the device id 51. And none of the messages are adressed to device id 51. Think the code 144B is not sendt from the sensor but from the software? But the code FF02 apears to be a brodcast from the device

I did not know HDL had any fresh air systems.
Do you have a model nr or anything on the unit?
Do you have a datasheet?
Are you trying to change the modes or do you only want to know what status it is at now?
What all the data is after the Mode(If you want to control the unit you will most likely have to send all the fields)?
Do you have any way of controling or reading the status from the unit now?
How does the unit 51 apear from the HDL buspro tool?

I think this is due to the fact that you have selected 0 as the target device id in the test software(Top left corner). Do you have a device with ID 0?

I dont think this is the same message as above this is 55873(DA44) code witch is the “Broadcast System Date and Time” and apears to be decoded correctly. This will start sending if you clicked the Broadcast computer time button on the command test software?

If you run this flow can you see anything in you nodered debug window when operating the unit from your phone?

[{"id":"2028b4409a28faca","type":"tab","label":"Ritech","disabled":false,"info":"","env":[]},{"id":"99c349440d10726e","type":"hdl-raw-in","z":"2028b4409a28faca","controller":"","name":"","x":150,"y":220,"wires":[["85c09ce6ab7f25a3","bec07bf6e3510bc3"]]},{"id":"85c09ce6ab7f25a3","type":"switch","z":"2028b4409a28faca","name":"sender","property":"sender","propertyType":"msg","rules":[{"t":"eq","v":"1.51","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":240,"wires":[["66a1f288d6695412"]]},{"id":"bec07bf6e3510bc3","type":"switch","z":"2028b4409a28faca","name":"target","property":"target","propertyType":"msg","rules":[{"t":"eq","v":"1.51","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":140,"wires":[["6ac1dbc2c178b255"]]},{"id":"346d7a1441e18b88","type":"comment","z":"2028b4409a28faca","name":"Command to module","info":"","x":410,"y":100,"wires":[]},{"id":"4d01437c34be4341","type":"comment","z":"2028b4409a28faca","name":"Answers from Module","info":"","x":420,"y":200,"wires":[]},{"id":"6ac1dbc2c178b255","type":"debug","z":"2028b4409a28faca","name":"To Device 51","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":140,"wires":[]},{"id":"66a1f288d6695412","type":"debug","z":"2028b4409a28faca","name":"From Device 51","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":560,"y":240,"wires":[]},{"id":"665659ea9e40cdaf","type":"comment","z":"2028b4409a28faca","name":"Debug","info":"","x":130,"y":60,"wires":[]}]

i am a chinese user


i have decode new type , code 5195

0x144B: {
parse: function(buffer) {
return {
acstatus: Boolean(buffer.readUInt8(1)), //Status. 1 on. 0 off.
acno: buffer.readUInt8(0), //AF No.
setupmode: buffer.readUInt8(3),//0 ai 1 manual 2 inside 3 constant temperature
setupspeed: buffer.readUInt8(2),//Fan Speed. 0 Auto. 1 High. 2 Medium. 3 Low.
temperature: {
insidetemp: buffer.readUInt32BE(26),//insidetemp
pm25: buffer.readUInt8(27),//pm25
tvoc: buffer.readUInt8(28),//tvoc
co2: buffer.readUInt8(29),//co2
humidity: buffer.readUInt8(25)//湿度
},
};
},
encode: function(data) {
var buffer = new Buffer(30);
var temperature = data.temperature;
buffer.writeUInt8(data.acstatus, 1);
buffer.writeUInt8(data.acno, 0);
buffer.writeUInt8(data.setupmode, 3);
buffer.writeUInt8(data.setupspeed, 2);
return buffer;
}
},

air fan sensor data is wrong , becos hdl decode this value

I just moved into this room. I’ll check the model of the new HDL device
Do you know what code 65282 stands for? I can see this message every few seconds in tools
1A 01 33 11 B6 FF 02 FF FF 01 04 0A 12 00 82 02 00 A0 00 00 00 DF 1A DA 38 2C

11 B6

this code have bug for few ac system
can’t resolve “acno”
if create two ac panel , when click no2 power , mqtt send acno = 1 to hdl
i dont’t know command.js how to check acno , topic?

I do not know the codes for the unit and they are not in any of the documentation i have available, but from other HDL devices i would expect up to 5 different codes.

  • Read Status message
  • Responce read status message
  • Control message
  • Responce control message
  • Status Broadcast message. That could be the code 65282 if it comes regulary.

If you import the flow attached on above message you should see all the messages going to the device id 51 and all the responces from the device. That way you can see what the control and responce messages are when changing the unit from the phone app.

Is this on the Fresh air module or are you trying to interface Air condition modules?

  • Read Status message
  • Responce read status message
  • Control message
  • Responce control message
  • Status Broadcast message. That could be the code 65282 if it comes regulary.

air fresh module read and write use same message
this message includes switch, speed, cycle mode and current PM2 5. TVOC, indoor temperature, etc
no responce message
you are right , 65282 is broadcast message from air fresh module
I plan to dismantle the weak current box recently and find out the specific model

To display the current temperature i recomend using the sensor that the AC module uses for each room. You should find the temperatures on the MQTT explorer under temp or you will have to use the one from the ac message i dont have access to my installation now but you should also see it in the mqtt explorer.

Are you not able to access the fresh air module from HDL buspro tool? It should show the model nr there.

If you use the flow above you should see all the traffic going in and out to the fresh air module?

6457 code is the “Response Read AC Status” So that means that when you open the phone app the app sends the code 6456 " Read AC Status" To get the value without the app you just need to send the same message from nodered.
I can see that the codes are not implemented but should be easy to implement if you send me some debug data.

If you could use the debug flow above and change the switch nodes with target and sender to the device id of the AC module and post what you get in the debug window. (I would like to get screenshots of the codes 6456, 6457, 6458 and 6459)

Thank you again @Linax, I really appreciate the effort you are putting in here :+1:

The curtain controller now seem to work correctly (up, stop, down). But the position indication is acting a bit weird:

  • Curtain is up. I click down. The motor runs in down direction
  • If I do not click stop - the relay will stop after 10 seconds (timer set in HDL config).
  • The status still shows the curtain is in down operation (arrow down).
  • If I click stop the curtain motor will not do anything (already stopped by timer) - but the status will then show «down» icon. If I click stop once more the curtain icon will show «open» icon.
  • The same thing happens on the way up. I run the curtain up - the motor stops by timer - but status stuck with up arrow icon. If i then click stop - the status icon will show up. If I click stop again it will stay in up status.

It seems that the status will not update unless I click stop - and somehow the down status will switch to up if pressing «stop» twice on the way down.

i slove ac problem , run ok now.

about air fresh , i found 5195 0x14 0x4b is response code , i try 5194 send command , not response , i try 5190 - 5200 all port , only 5195 work , control and response on same port . when i send control code, not response show , but few seconds , about 30 secs , air fresh boardcoast status , this status code same as control code. by observing , i think this boardcast time its random ,about 30 - 60 sec. this is a problem ,when i set air fresh to on , not response from hdl to mqtt save temp oldhdlstate , lovelace can’t get now status .
I don’t know if I missed the real control port number,
Does each controller of hdl have more than two ports? Separate read and write?

Temporarily solve the problem of air fresh sending status. I send the get flow send to hdl to hdl to switch to mtqq at the same time, which manually updated the value of mtqq. I’ll keep looking for the real control port.
I am now using the climate control panel to control the fresh air blower
It can display the temperature of the new fan, but cannot display the values ​​such as tvoc pm2.5, how can I display it?
In addition to the mode selection, I can’t add setupmode, there are fresh fan modes, automatic mode, manual mode, internal circulation mode, constant temperature mode, how can I add it to the options
My switch mode is fan_only and off of the air conditioner.
The limitation of mqtt cannot add some custom modes

#AF

  • platform: mqtt
    name: “air fresh”
    modes:
    • “off”
    • “fan_only”
      fan_modes:
    • “auto”
    • “low”
    • “medium”
    • “high”
      current_temperature_topic: “hdl/af/1.51.1”
      current_temperature_template: “{{value_json.temperature.insidetemp}}”
      mode_state_topic: “hdl/af/1.51.1”
      mode_command_topic: “hdl/af/1.51.1/mode/set”
      mode_state_template: “{{value_json.status}}”
      fan_mode_state_topic: “hdl/af/1.51.1”
      fan_mode_command_topic: “hdl/af/1.51.1/fan/set”
      fan_mode_state_template: “{{value_json.setupspeed}}”

QQ图片20220505195845

Must be a bug somewhere, will check when i have some more time :slight_smile:

Yes i belive so, thermostats, relays, dimmers and US switches at least have. If you run the flow above and report the codes you get to the debug window i can have a look at it, without it i am not realy able to help as i can not see what is going on.
It is also possible you can get the API documentation from HDL china tech support for the module, my local HDL distributor does not have the units and thus will not supply it to me.

Run the flow above and report what you get in the debug, i expect the sensor values to be present in one of the broadcast messages, could be that the value will need to be scaled as well(Will have to check what the value is in the phone app at the same time and post and i can try to decode it).

True but you can add custom modes as presets look in to the “preset_modes”, check the example for heatmodule above. Can give you example if you share your current flow and the mentioned debugs.

i use preset_mode_value_template
control air fresh setupmode ok

preset_mode_state_topic: "hdl/af/1.51.1"
preset_mode_command_topic: "hdl/af/1.51.1/textmode/set"
preset_mode_value_template: "{{value_json.setupmode}}"

but i setup 4 mode , lovelace show 5 mode , add a "none mode

hi linax
I have tried to use it. During the use, I found a small bug. When the system is in the initial stage, if I use the auto mode to start the air conditioner, it will jump to the cool mode, but it will be normal when I click it again. After careful analysis of the data packets, this problem should be caused by hdl. When I sent 0x03 (auto) to my gateway for the first time, the feedback was actually 0x00. I tried a lot, and the first boot after the system reset will appear. Now The solution is to send the packet twice when the setupmode is auto, and only send it once in other modes. I don’t know yet how to return msg twice through the function, I’m just using hdl buspro tools to send packet.

Is it possible to capture click of a button? I.e on a DLP or iTouch 4btn. I would like to turn on a Hue lamp or perform other actions when pressing a button on the iTouch.

The Universal switch could work - but it’s a bit more flexible to use the button directly in HA.

Is this something you have any experience with @Linax ? :slight_smile: