Mochad, the X10 interface used by Domoticz, supports dimming like so:
Code: Select all
echo pl A1 xdim 63 | nc localhost 1099
(I have Marmitek LW11 dimmers and this works fine)
I wrote 2 simple scripts which based on values from a dummy dimmer, send instructions directly to Mochad.
Unfortunately, based on what Mochad reports to have done (and done well) DOmoticz will report an error (in the log) which can be ignored
Code: Select all
Error: Mochad: Cannot decode 'Tx PL HouseUnit: O13 Func: Ext code 1, data, control Data: 00 Command: 31'
LUA script: Identify the dimmer which changed, find corresponding X10Address, identify "On", "Off" or "Slider position Changed" send appropriate values to a BASH script. (Save as /home/pi/domoticz/scripts/lua/script_device_dimmers.lua on a raspberry)
Code: Select all
commandArray = {}
local BASHSCRIPT = "/home/pi/domoticz/scripts/lua/mochad_dim.sh " --keep the space at the end!
local X10Address
local bashcall
local intdata
dimmers = {}
-- Dimmer names must be strictly identical to the dimmer labels
dimmers["Lumiere Salon"]="o4"
dimmers["Lumiere Salle a Manger"]="o6"
dimmers["Lumiere Chambre 1"]="o8"
dimmers["Lumiere Chambre 2"]="o10"
dimmers["Lumiere Entree"]="o11"
dimmers["Lumiere Bureau"]="o12"
dimmers["Lumiere Chambre 3"]="o13"
for deviceName,deviceValue in pairs(devicechanged) do
--Find the X10 Address
X10Address=dimmers[deviceName]
--If a registered Dimmer
if X10Address ~= nil then
-- Create appropriate way to call the BASH script
--print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'");
if deviceValue == "On" then
bashcall=BASHSCRIPT ..X10Address.." ".. "On"
elseif deviceValue == "Off" then
bashcall=BASHSCRIPT ..X10Address.." ".. "Off"
else
intdata=(tostring(math.floor(tonumber(string.sub(deviceValue,-5,-2))*0.63)))
bashcall=BASHSCRIPT..X10Address.." "..intdata
end
--Call the Bash script
os.execute(bashcall)
end
end
return commandArray
Code: Select all
if [ "$2" = Off ];then
echo pl $1 off | nc localhost 1099
elif [ "$2" = On ];then
echo pl $1 on | nc localhost 1099
else
echo pl $1 xdim $2 | nc localhost 1099
fi
All-tough this works, it is a hack, it would be nice if X10 dimmers would be supported directly!
(Liberate the slider on the png, send " xdim & int(slidervalue *.63) to the dimmer when it changes ...and a lot of X10 users would be happy!)
PS:
As I found it tricky to find how to create dummy dimmers (this is not done as you would expect):
To create a Dummy Dimmer
1) In Hardware Create Dummy Hardware
2) Create a Dummy switch by clicking on Create Virtual Sensors n the Hardware page. (And not on the Switches Page! Your slider will not work!)
Choose Switch as Sensor type.
3) On the Switches page edit the just created switch and set the type to Dimmer