ZW162 (Aeotec Siren 6) No siren switches Domoticz -> ZW-JS-UI

For Z-Wave related questions in Domoticz

Moderator: leecollings

rapperobert
Posts: 27
Joined: Friday 14 December 2018 14:20
Target OS: Linux
Domoticz version:
Contact:

Re: ZW162 (Aeotec Siren 6) No siren switches Domoticz -> ZW-JS-UI

Post by rapperobert »

an update for users with the same problem.
It appears to be a problem that the volume dimmer in Domoticz is compatible with a volume field in Zwave JS that does not work,
there are 2 fields in Zwave JS with volume
"[78-121-1-defaultVolume] Default volume" and
[78-121-1-volume] Volume
domotic is connected to the last [78-121-1-volume] Volume and it does not work in zwave JS so domoticz could be connected on the first mentioned.
There has been a response on GitHub and I hope they can/will resolve it now that the problem has become somewhat clear.

However, more is needed than just linking the button to a different volume field. To make the siren work, you will also need to be able to set the sound tone. and that field is not in domoticz at all.
As soon as there is more to report, I will do so here.
rapperobert
Posts: 27
Joined: Friday 14 December 2018 14:20
Target OS: Linux
Domoticz version:
Contact:

**Aeotec 6 Siren Workaround**: ZW162 (Aeotec Siren 6) No siren switches Domoticz -> ZW-JS-UI

Post by rapperobert »

**Aeotec 6 Siren Workaround**




While this solution might not be the most elegant, it works. I'm just a simple user who figured this out through trial and error. For technical support, please be aware that my expertise might be limited. However, I believe the following guide should help you get started.

**Steps**:

1. **Create 3 Dummy Switches**:
- **Sirene Sound**: A selector switch. This will be used to choose your sound, so populate it with values from 1 to 30. The first field is 0, which means no sound.
- **Sirene Control**: A standard switch. This will be used to turn the siren on or off.
- **Sirene 1 Volume Dummy**: A dimmer switch. This will be used to adjust the siren's volume.

2. **Install Mosquitto Clients on the Domoticz Docker Container**:

*Note*: You will lose these changes when the container is refreshed, so you might need to redo these steps after updating the container. If anyone knows a better solution, please share!

- Open your terminal.
- Run `docker ps` to see the container ID for Domoticz.
- Replace `[CONTAINER_NAME_OR_ID]` with the container ID in the following command:


docker exec -it [CONTAINER_NAME_OR_ID] /bin/sh

- Install Mosquitto Clients:

apt update
apt-get install mosquitto-clients

- You can now test with:

mosquitto_pub -h [YOUR_BROKER_IP] -p 1883 -t "[YOUR_MQTT_PREFIX]/sirene_aeotec_6/121/1/toneId/set" -m '{"value": 14}'
```
For example:

mosquitto_pub -h x.x.x.x -p 1883 -t "zwavejs/sirene_aeotec_6/121/1/toneId/set" -m '{"value": 14}'


- The siren should turn on. Change 14 to 0 to turn it off.
- Exit with `exit`.

3. **Domoticz Scripting**:
- In Domoticz, navigate to the script editor and create a DzVents script. Note that the broker name below is the MQTT prefix you used in Zwave JS.

Code: Select all

 return {
         on = {
             devices = { 'Sirene Control' }
         },
         execute = function(domoticz, device)
             local brokerIp = '[YOUR_BROKER_IP]'
             local brokerPort = '1883'
             local topic = '[YOUR_MQTT_PREFIX]/sirene_aeotec_6/121/1/toneId/set'
             local message = ''

             -- Get the selector level name from 'Sirene Sound'
             local sireneSoundValue = domoticz.devices('Sirene Sound').levelName
             
             -- Check the state of 'Sirene Control' switch
             if device.state == 'On' then
                 message = '{"value": ' .. sireneSoundValue .. '}'
             else
                 message = '{"value": 0}'
             end
             
             local command = '/usr/bin/mosquitto_pub -h ' .. brokerIp .. ' -p ' .. brokerPort .. '  -t "' .. topic .. '" -m \'' .. message .. '\''
             domoticz.log('About to execute command: ' .. command, domoticz.LOG_INFO)
             
             local result = domoticz.executeShellCommand(command)
             
             -- Log the command result
             domoticz.log('Result of the command: ' .. tostring(result), domoticz.LOG_INFO)
         end
     }


- For volume control, create a separate script:

Code: Select all

 return {
         on = {
             devices = { 'sirene 1 volume dummy' }
         },
         execute = function(domoticz, device)
             local brokerIp = '[YOUR_BROKER_IP]'
             local brokerPort = '1883'
             local topic = '[YOUR_MQTT_PREFIX]/sirene_aeotec_6/121/1/defaultVolume/set'
             
             -- Get the dimmer level and include it in the message
             local message = '{"value": ' .. device.level .. '}'
             
             local command = '/usr/bin/mosquitto_pub -h ' .. brokerIp .. ' -p ' .. brokerPort .. ' -t "' .. topic .. '" -m \'' .. message .. '\''
             
             domoticz.log('About to execute command: ' .. command, domoticz.LOG_INFO)
             
             local result = domoticz.executeShellCommand(command)
             
             -- Log the command result
             domoticz.log('Result of the command: ' .. tostring(result), domoticz.LOG_INFO)
         end
     }


I hope this guide is clear enough to help those struggling with this issue. The Domoticz team is working on a permanent solution, but until then, this workaround should suffice.

---

Note: Be sure to replace placeholder values like `[YOUR_BROKER_IP]` and `[YOUR_MQTT_PREFIX]` with your actual values before using the script.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest