HDL Smartbus via NodeRed and MQTT

Any one have rewritten the yaml and got it to work?

Yes.

Yes. Did you not get it working? To change the code easy i would recomend replace function in the editor. Can share some code if needed?

Would be thankful if you shared a code example which I could copy.

I having som truble geting climate back up. its somthing with the preset mode.

Was the same before atleast, so should work.

Can you share the flow you are using?

I have split the config into different files for each type. If starting from scratch i think i would use 1 file per device with packages files, but this is the way i had it before and i just changed to new formatting with search and replace function.

configuration.yaml:

mqtt: !include mqtt.yaml

mqtt.yaml:

#Lights
light: !include lights_mqtt.yaml
# Relays and Universal Switches
switch: !include switch_mqtt.yaml
# Tempratures
sensor: !include sensor_mqtt.yaml
#Dry contacts / Binary sensors
binary_sensor: !include binarysensor_mqtt.yaml
# Climate
climate: !include climate_mqtt.yaml
# Blinds and garage door
cover: !include cover_mqtt.yaml

lights_mqtt.yaml:

#1 - Soverom Spots
- schema: template
  name: "Soverom Spots"
  state_topic: "hdl/sc/1.60/1"
  command_topic: "hdl/sc/1.60/1/set"
  command_on_template: >
    {"state": "on"
    {%- if brightness is defined -%}
    , "level": {{ brightness }}
    {%- else -%}
    , "level": 255
    {%- endif -%}
    }
  command_off_template: '{"state": "off", "level": 0}'
  state_template: "{{ 'on' if value_json.level | int > 0 else 'off' }}"
  brightness_template: "{{ value_json.level }}"
#2 - Gang Spots
- schema: template
  name: "Gang Spots"
  state_topic: "hdl/sc/1.60/2"
  command_topic: "hdl/sc/1.60/2/set"
  command_on_template: >
    {"state": "on"
    {%- if brightness is defined -%}
    , "level": {{ brightness }}
    {%- else -%}
    , "level": 255
    {%- endif -%}
    }
  command_off_template: '{"state": "off", "level": 0}'
  state_template: "{{ 'on' if value_json.level | int > 0 else 'off' }}"
  brightness_template: "{{ value_json.level }}"

switch_mqtt.yaml:

#1 - Gang Varmekabel
- name: "Gang Varmekabel"
  state_topic: "hdl/sc/1.80/1"
  command_topic: "hdl/sc/1.80/1/set"
  payload_on: '{"level": 255}'
  payload_off: '{"level": 0}'
  value_template: "{{value_json.level}}"
  state_on: "255"
  state_off: "0"
#2 - Gjestebad Varmekabel
- name: "Gjestebad Varmekabel"
  state_topic: "hdl/sc/1.80/2"
  command_topic: "hdl/sc/1.80/2/set"
  payload_on: '{"level": 255}'
  payload_off: '{"level": 0}'
  value_template: "{{value_json.level}}"
  state_on: "255"
  state_off: "0"

sensor_mqtt.yaml:

#1 - Temperatur Gulv Gang
- name: "Temperatur Gulv Gang"
  state_topic: "hdl/temp/1.55/1"
  unit_of_measurement: "°C"
#2 - Temperatur Gulv Vindfang
- name: "Temperatur Gulv Vindfang"
  state_topic: "hdl/temp/1.55/2"
  unit_of_measurement: "°C"

binarysensor_mqtt.yaml:

########## Pir Vindfang ##########
- name: "Bevegelse Vindfang"
  state_topic: "hdl/us/1.140/215"
  payload_on: "ON"
  device_class: motion
########## 12i1 Gang ##########
- name: "Bevegelse Gang"
  state_topic: "hdl/us/1.141/215"
  payload_on: "ON"
  device_class: motion

climate_mqtt.yaml:

########## Varmekabel Gang ##########
- name: "Varmekabel Gang"
  modes:
    - "off"
    - "heat"
  mode_state_topic: "hdl/fh/1.100/01"
  mode_state_template: "{{value_json.status}}"
  mode_command_topic: "hdl/fh/1.100/mode/set"
  #current_temperature_topic: "hdl/fh/1.100/01"
  #current_temperature_template: "{{value_json.temperature.current}}"
  current_temperature_topic: "hdl/temp/1.100/1"
  temperature_state_topic: "hdl/fh/1.100/01"
  temperature_state_template: "{{value_json.temperature.now}}"
  temperature_command_topic: "hdl/fh/1.100/temperature/set"
  preset_modes:
    - "Normal"
    - "Day"
    - "Night"
    - "Away"
    - "Timer"
  preset_mode_state_topic: "hdl/fh/1.100/01"
  preset_mode_value_template: "{{value_json.textmode}}"
  preset_mode_command_topic: "hdl/fh/1.100/textmode/set"
  min_temp: 5
  max_temp: 35
  precision: 0.1
########## Varmekabel Vindfang ##########
- name: "Varmekabel Vindfang"
  modes:
    - "off"
    - "heat"
  mode_state_topic: "hdl/fh/1.102/01"
  mode_state_template: "{{value_json.status}}"
  mode_command_topic: "hdl/fh/1.102/mode/set"
  #current_temperature_topic: "hdl/fh/1.102/01"
  #current_temperature_template: "{{value_json.temperature.current}}"
  current_temperature_topic: "hdl/temp/1.102/1"
  temperature_state_topic: "hdl/fh/1.102/01"
  temperature_state_template: "{{value_json.temperature.now}}"
  temperature_command_topic: "hdl/fh/1.102/temperature/set"
  preset_modes:
    - "Normal"
    - "Day"
    - "Night"
    - "Away"
    - "Timer"
  preset_mode_state_topic: "hdl/fh/1.102/01"
  preset_mode_value_template: "{{value_json.textmode}}"
  preset_mode_command_topic: "hdl/fh/1.102/textmode/set"
  min_temp: 5
  max_temp: 35
  precision: 0.1

cover_mqtt.yaml:

# Blind Bedroom
- name: "Blind Bedroom"
  device_class: shade
  # Description for command_topic and set_position_topic: hdl/cp/"subnet"."deviceid"/"curtain ch"."milliseconds to open"."milliseconds to close."steps"/"topic"
  command_topic: "hdl/cp/1.142/1.22750.22750.10/set"
  set_position_topic: "hdl/cp/1.142/1.22750.22750.10/set"
  state_topic: "hdl/cp/1.142/2/state"
  position_closed: 0
  position_open: 100
  position_topic: "hdl/cp/1.142/1/position"

Hope this helps.

Working ok for me after the upgrade. Are you using DLP or the heatingmodule as the master? How does your config look? Is it not working at all or only error with preset modes?

Using the heatingmodule as master. Most work exept preset modes. Cant switch between them. Getting undefinderror: ‘value_json’ is undefind

Strange, how does your config for it look?

Did loose a " at the end of preset_mode_value_template: :slight_smile:
So think i need glasses :stuck_out_tongue: But now all works :slight_smile:
In node-red i get error in javascript code on all places where newpower is written.
Both floorheat and ac. Is this just a bug?

Perfect, done the same many times :smiley:

Do you mean if you open the function node it is underlined with red or do you get an error in the debug window when it is triggered?

only underlined red and gets warning on deploy :slight_smile:

That is just my lack of coding knowledge. Guess nodered upgraded their code checking as i did not get errors before when i wrote it.

Think it is that i i forgot to define newpower as a variable.
so instead of:

if (power === true){newpower = "heat"}
if (power === false){newpower = "off"}

it should be:

if (power === true){var newpower = "heat"}
if (power === false){var newpower = "off"}

I might be wrong and if anybody knows feel free to correct me.

Also pretty sure using 2x if statements there is not the correct/optimal way of doing it, but it works :slight_smile:

that did work. yes last year it so mutch new stuff both in node and HA

@linax please see below the node-red flow

[{"id":"fef4ca11f287479d","type":"hdl-raw-out","z":"d409d0a29f7f44cf","controller":"378dce6a2d14e592","name":"","x":1250,"y":1580,"wires":[]},{"id":"378dce6a2d14e592","type":"hdl-controller","host":"192.168.1.200","port":"6000","subnetid":"1","deviceid":"100","broadcast":false,"daliId":"0"}]

This is what is in the /config/lights_mqtt.yaml

#1 -  Room
- schema: template
  name: "Room Light"
  state_topic: "hdl/sc/1.73/7"
  command_topic: "hdl/sc/1.73/7/set"
  command_on_template: >
    {"state": "on"
    {%- if brightness is defined -%}
    , "level": {{ brightness }}
    {%- else -%}
    , "level": 255
    {%- endif -%}
    }
  command_off_template: '{"state": "off", "level": 0}'
  state_template: "{{ 'on' if value_json.level | int > 0 else 'off' }}"
  brightness_template: "{{ value_json.level }}"

I can see on MQTT Explorer the message being published to hdl/sc/1.73/7/set
{“state”: “on”, “level”: 255}

In the lights_mqtt.yaml file, I have set the Light’s SubNet ID (1), DeviceID (73) and ChannelNo(7) as per the lights setup on the Smart-Bus G4 Mobile app which works controlling this particular light.

I assume the hdl-raw-out gateway is the SmartBus RSIP-DN module. The only item i’m not sure about is the DALI ID setting (i’ve just left it to 0, and the broadcast flag is blank).

If i use the Smart Cloud Configuration Software, i can this device has a subnet ID = 1, Device ID = 100, IP: 192.168.1.200, Port: 6000, Route IP: 192.168.1.1

Home assistant is able to communicate correctly with MQTT server. So it is either no communication between HDL - Nodered or Nodered to MQTT Server.

I think it is the device id in the controller node.

The HDL controller node in Nodered should not have the same device id as the network module. It needs to be on the same subnet but the device id should be a unique device id.

If you use this test flow below do you get any data on the debug field. You should now see all messages that is on the bus.

[{"id":"5e70c30a4b144e09","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"86d425f0833ca2ea","type":"hdl-raw-out","z":"5e70c30a4b144e09","controller":"c61b2bc9e244411f","name":"","x":390,"y":140,"wires":[]},{"id":"0f200e9141218636","type":"hdl-raw-in","z":"5e70c30a4b144e09","controller":"c61b2bc9e244411f","name":"","x":130,"y":320,"wires":[["a3b382ec07182c6c"]]},{"id":"a3b382ec07182c6c","type":"debug","z":"5e70c30a4b144e09","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":380,"y":320,"wires":[]},{"id":"f5ebe4442b880119","type":"inject","z":"5e70c30a4b144e09","name":"On 100%","props":[{"p":"target","v":"1.73","vt":"str"},{"p":"code","v":"49","vt":"num"},{"p":"payload.channel","v":"7","vt":"num"},{"p":"payload.level","v":"100","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":80,"wires":[["86d425f0833ca2ea"]]},{"id":"c7d83288ed2ba2c8","type":"inject","z":"5e70c30a4b144e09","name":"On 50%","props":[{"p":"target","v":"1.73","vt":"str"},{"p":"code","v":"49","vt":"num"},{"p":"payload.channel","v":"7","vt":"num"},{"p":"payload.level","v":"50","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":140,"wires":[["86d425f0833ca2ea"]]},{"id":"99324e6be5c1668c","type":"inject","z":"5e70c30a4b144e09","name":"Off","props":[{"p":"target","v":"1.73","vt":"str"},{"p":"code","v":"49","vt":"num"},{"p":"payload.channel","v":"7","vt":"num"},{"p":"payload.level","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":200,"wires":[["86d425f0833ca2ea"]]},{"id":"c61b2bc9e244411f","type":"hdl-controller","host":"192.168.1.200","port":"6000","subnetid":"1","deviceid":"103","broadcast":false,"daliId":"0"}]

It should also be possible to change the light by pressing the incject nodes.
Here i assumed device 103 is available it needs to be changed if not.

Hello
The dali module can only control the brightness but not the color temperature. I don’t know how to add it to the node red

How are you able to control it from HDL? Is it a seperate code?

Thanks @Linax for the test flow, it has really been helpful. In the test flow, only when i changed the HDL-Controller node host to 255.255.255.255 and switched Broadcast flag on, i could then see the commands from NodeRed go through to the Smart-Bus 1.73 device. If I tried using the Smart-Bus RS-IP IP address without broadcast, then i couldn’t see any commands go to the device (and nothing would show up in debug console).

In the Node-Red Debug Console I now see:

{"sender":"1.100","target":"1.73","code":49,"payload":{"channel":7,"level":100,"time":0},"topic":"command","_msgid":"209728ae7ec38e23"}

By using the SmartCloud Command Test tool which lets you see network traffic to a specific Device, I can now see the commands being sent by NodeRed to the 1.73 Device itself (and i can compare it to commands sent from the SmartBus G4 IOS App or the physical keypad)

However, the Node-Red command doesn’t seem to be switching on the light. This is what the ON command looks like when coming from NodeRed to the device when clicking inject “On 100%”

CRC00001 11:00:38:665 : 0F 01 64 FF FE 00 31 01 49 07 64 00 00 7C 0B

When i try from the SmartBus G4 IOS App (which switches on the light), the command that hits the device is as follows:

CRC00001 11:09:53:579 : 0F BB BB CC CC 00 31 01 49 07 64 00 00 AF 58

And from the physical light keypad when switching on:

CRC00001 11:31:36:263 : 0C 01 B2 00 F0 00 33 01 49 00 9E 4B
CRC00002 11:31:36:294 : 14 01 49 02 26 00 34 01 B2 08 00 00 00 00 00 00 00 00 CE F5
CRC00003 11:31:36:498 : 10 01 B2 00 F0 00 31 01 49 07 64 00 00 04 62 75
CRC00004 11:31:36:516 : 0E 01 49 02 26 00 32 FF FF 07 F8 64 24 15

This part is the same between the two 00 31 01 49 07 64 00 00 (but the prefix and suffix characters are different)

Any ideas?

Broadcast is only if you should get it as raw in to nodered when you send it on raw out(In your case to the debug window but is not needed for normal operation)

Are you sure about the ip of the module and is it on the same network as Home assistant?

Have checked your codes. Still think you are sending with 1.100 in the nodered config.

Here you can see Nodered is still sending from Device id 100. This will not work if that is what your ip/network module has?

1st line is: Code 51 - Read Status of Channes:


2nd line is: Code 52 - Response Read Status of Channels(Responce from Dimmer with 8 channels and all fully off ):

3rd line is: Code 49 - Single Channel Control

4th line is: Code 50 - Response Single Channel Control (Is responce from dimmer. What shows as Level is sucess and Running time is new level)

The messages look ok and work the same as HDL.

Change the Device id to a unique address, it can not be the same as the ip module. On the network data you attached it is still 100. This is the same as your network module?

Let me know if that works.