To control it, I've set up a dummy dimmer switch and this lua code:

Code: Select all
commandArray = {}
DomDevice = 'myfan';
IP = '192.168.1.50';
if devicechanged[DomDevice] then
if(devicechanged[DomDevice]=='Off') then
DomValue = 0;
else
DomValue = otherdevices_svalues[DomDevice];
CalcValue = (7.23* DomValue) + 300;
end
if CalcValue==nil then CalcValue=0 end
runcommand = "curl 'http://" .. IP .. "?speed=" .. CalcValue .. "'";
os.execute(runcommand);
print("PWM value= "..CalcValue);
end
return commandArray

The "trouble" starts in Homebridge/Homekit. I run homebridge with eDomoticz plugin on the same raspberrypi as where I run Domoticz.
It shows up as a light instead of a fan.
When I add the virtual switch by clicking "Manual Light/Switch" from the switch tab and choose a dimmer with type AC, I get this:

And this does show up as a fan in homebridge/homekit.
Left is the Dimmer of type AC, right Dimmer of type Switch

From what I've read here https://www.sigmdel.ca/michel/ha/x10/pole_04_en.html that last method is not the correct way to set up a virtual dimmer.

I would like to know if anyone managed to create a proper virtual dimmer switch of some sort that shows up as a fan in homebridge/homekit.