**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.