Multiple values (high-byte/low-byte) in data_template using zwave.set_config_parameter

I’m trying to send a config parameter to zwave using zwave.set_config_parameter.

The problem is that the value is two values as shown here (page 6).

The values are defined as ‘high-byte’ and ‘low-byte’.

My current, not working automation is:

alias: Set Doorbell to Frontdoor
trigger:
  - platform: state
    entity_id: input_select.doorbell
    to: 'Frontdoor'
    from: 'Backdoor'
action:
    - service: zwave.set_config_parameter
      data_template: {
        "node_id": 14,
        "parameter": 37,
        "value": 5,1
      }

I also tried "value": [5,1] with no luck.

I have solved this by converting the values between two 8 bit bytes to a single 16 bit decimal.

For the Aeotec Siren Version Gen5 the values for different sounds are:

Value1 - high byte (change the sound):
0: do not change the current Siren sound.
1: Siren sound 1 is selected.
2: Siren sound 2 is selected.
3: Siren sound 3 is selected.
4: Siren sound 4 is selected.
5: Siren sound 5 is selected.

Value2 - Low Byte (adjust the volume):
0: do not change the current volume.
1: set the volume to 88 dB.
2: set the volume to 100 dB.
3: set the volume to 105 dB.

I wrote a quick C++ script that is able to perform the conversion, compile with g++:

#include <iostream>

int main () {

  // 16 bit Decimal to low/high 8 bit bytes 
  unsigned int count = 1025;

  int lowbyte = (count & 0xff);
  int highbyte = (count >> 8);
  std::cout << "Decimal:\t" << count << std::endl;
  std::cout << "High Byte:\t" << highbyte << std::endl;
  std::cout << "Low Byte:\t" << lowbyte << std::endl;

  // low/high 8 bit bytes to 16 bit Decimal
  highbyte = 5;
  lowbyte = 1;

  int decimal_16bit = highbyte * 256UL | lowbyte;
  std::cout << "\nHigh Byte:\t" << highbyte << std::endl;
  std::cout << "Low Byte:\t" << lowbyte << std::endl;
  std::cout << "Decimal:\t" << decimal_16bit << std::endl;

  return 0;
}

This outputs:

Decimal:    1025 
High Byte:  4
Low Byte:   1

High Byte:	5    
Low Byte:	1
Decimal:	1281

So the automation becomes:

alias: Set Doorbell to Frontdoor
trigger:
  - platform: state
    entity_id: input_select.doorbell
    to: 'Frontdoor'
    from: 'Backdoor'
action:
    - service: zwave.set_config_parameter
      data_template: {
        "node_id": 14,
        "parameter": 37,
        "value": 1281
      }
3 Likes

As of the current version of HA (0.44.1), the value is messed up as described in this issue:

Using HA 0.51.2, I am having difficulty getting the set_config_parameter functionality to work with the Aeotec Siren Version Gen5. Calling this service from the HA Z-Wave Manager works, showing the issuance of:

2017-08-18 20:14:40.750 Info, Node008, Value::Set - COMMAND_CLASS_CONFIGURATION - Siren sound and Volume - 37 - 1 - Sound 2 - Low Volume
2017-08-18 20:14:40.751 Info, Node008, Configuration::Set - Parameter=37, Value=513 Size=2

in the OZW_Log.txt. This successfully changes sound and volume.

However, when calling the same method from a script or an action does not appear to work!
If I execute a script such as:

- service: zwave.set_config_parameter
  data_template: {
    "node_id": 8,
    "parameter": 37,
    "value": 257,
    "size": 2
    }
- service: switch.turn_on
  entity_id: switch.aeotec_zw080_siren_gen5_switch
- delay:
    seconds: 2
- service: switch.turn_off
  entity_id: switch.aeotec_zw080_siren_gen5_switch

then the sound does not get changed, nomatter what value is used! I merely get 3 seconds of alarm as previously set in the Z-Wave Manager. The OpenZWave log shows for the start of this sequence:

2017-08-18 21:03:36.888 Info, Node008, Value::Set - COMMAND_CLASS_SWITCH_BINARY - Switch - 0 - 1 - True
2017-08-18 21:03:36.888 Info, Node008, SwitchBinary::Set - Setting node 8 to On

and in the HA log I get:

2017-08-18 21:03:36 ERROR (Thread-8) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py", line 1030, in execute_service service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/zwave/__init__.py", line 443, in set_config_parameter value.data = selection
File "/srv/homeassistant/lib/python3.4/site-packages/openzwave/value.py", line 292, in data self._network.manager.setValue(self.value_id, value)
File "src-lib/libopenzwave/libopenzwave.pyx", line 2867, in libopenzwave.PyManager.setValue (openzwave-embed/open-zwave-master/python-openzwave/src-lib/libopenzwave/libopenzwave.cpp:23786)
TypeError: Expected str, got int

I have also tried excluding the “size” parameter, and enclosing all parameter values in quotes, but get the same behaviour.

Any ideas? Is there a way to force COMMAND_CLASS_CONFIGURATION communication rather than just COMMAND_CLASS_SWITCH_BINARY?

Thanks!

Refer to the following:

https://github.com/home-assistant/home-assistant/issues/7983

Use the label instead of the decimal.

    - service: zwave.set_config_parameter
      data:
        node_id: 21
        parameter: 37
        value: 'Sound 3 - Mid Volume'
1 Like

Hi,

Any idea how I can accomplish the same thing with the Dlink DCH-Z510 which is the same as a Zipato Siren.

The alarm works no problem but I would like to control the notification types to be able to use the door bell feature as listed in the manual:

This works in Vera but unsure as to how to port this to HASS:

Emergency
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0x7 0x1 0x0 0x0’},1)

Fire
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0xA 0x2 0x0 0x0’},1)

Ambulance
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0xA 0x3 0x0 0x0’},1)

Police
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0xA 0x1 0x0 0x0’},1)

Door Chime
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0x6 0x16 0x0 0x0’},1)

Beep Beep
luup.call_action(‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘SendData’,{Node=‘13’,Data=‘0x71 0x5 0x0 0x0 0x0 0x0 0xA 0x5 0x0 0x0’},1)

If you are able to change it from the Z-Wave Manager, then you should be able to use the “Config Value” in the “Node Config Options” section as the value in your automation.

hi @gazoscalvertos, any update on this?
I just installed a dlink Z510 siren, and I’m wondering how to change sound and volume.

thank you for attention

at the moment only by sending raw data to the device using a patch in openzwave https://github.com/OpenZWave/open-zwave i.e. not in Home Assistant. Hopefully someone bring the functionality to HA

The patch is in one of the issues, i will try and find it if you need it

thanks for your reply. I dont need it right now, hope it will be soon integrated in HA.

Has anyone looked any more into this? At the moment my DCH-Z510 is effectively a brick… :frowning:

Hi, Can you describe how you manage to send raw data to the device? I saw there was a MR about that but I cannot get info on how should I implement that in HA.

1 Like