Fan control over http with virtual dimmer and homebridge

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
mistervinnie
Posts: 1
Joined: Wednesday 22 December 2021 16:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Fan control over http with virtual dimmer and homebridge

Post by mistervinnie »

I have a pwm fan that is controlled by an ESP. I can control the fan by sending a value, something like http://192.168.1.50?speed=800
To control it, I've set up a dummy dimmer switch and this lua code:
Image

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
All the above works like a charm :)

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:

Image

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

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. :? With this solution there are steps of 6% and I need to modify the lua, because it doesn't pass along 0-100%, but discrete steps.

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest