mongoose-os-apps / shelly-homekit

Apple HomeKit firmware for Shelly's
Other
1.82k stars 130 forks source link

Add support for fan with speeds using Shelly 2.5 #337

Closed MichaelVdheeren closed 2 months ago

MichaelVdheeren commented 3 years ago

Can we get a firmware version that allows the Shelly 2.5 to be used as a fan within Homekit with each of the inputs being mapped to a fan speed? No input would mean fan is low, input 1 means fan is medium, input 2 means fan is high. Mapped to the same output of course.

freddair commented 3 years ago

My bath fan has 2 speeds which correspond to 2 fan inputs / Shelly outputs:

So for me Shelly 2.5 would need to interlock output 1 and 2.

off: both outputs off low: output 1 on, output 2 off high: Output 1 off, output 2 on

When both outputs are on, the fan runs very low, but I am not sure if it's safe to use as that's not specified in the manual.

andyblac commented 3 years ago

why not just set homekit type to fan in homekit settings ?

freddair commented 3 years ago

That's what I currently do using an Aqara double rocker switch. The problem is that it just appears as 2 separate Fan switches and not as fan speed steps, and it does not allow real interlocking of the outputs. I simulate it with scenes but it's not optimal as relays don't switch simultaneously (one after another). image

MichaelVdheeren commented 3 years ago

Correct, just changing from switch to a fan is an icon. This means I get two elements in the Home App and not a single fan with two speeds that I can set. What we would need is what you see below.

image

rojer commented 3 years ago

HAP fan service has speed control as a %, from 0 to 100, but i guess we could have 0-30-60-100 fixed points, something like that. i am not familiar with fans (i live in ireland, you see, we don't need them here :) ), can you explain what kind of fan are you using? what are the connections? how common is this type of fan?

freddair commented 3 years ago

Here's mine, built into the bathroom ceiling to exhaust steamy and/or stinky air ;-)

https://www.vortice.ltd.uk/shop/residential-ventilation/quadro/quadro-micro-100-i-es/

image

MichaelVdheeren commented 3 years ago

I have exactly the same as above. Very common system in Belgium used for ventilation of the home which is mandatory for newly built homes.

I would suggest using 0 - 50 -100 because you can not turn of most of these ventilators - by default they are always in stand 1. You can change them to mode 2 or mode 3.

jsiegenthaler commented 3 years ago

High speed is obviously 100% Low speed could be user-configurable, or locked at 50% The core question would be: how would homekit react to the speed control slider: would it "lock" to 50% when between 25% and 75%, and lock to 0% or 100% when outside of the 25-75% range? Also, anyone wiring this up must be sure not to wire Live to both terminals at the same time. Some fans are simple and use a series resistor to slow down the speed, then it wouldn't matter. But some fans might have different coils or taps on the coils to change the motor speed. Then it may very much matter how it is switched.

andyblac commented 3 years ago

my bathroom fan is a constant presure fan with boost. ie it is contantly on, and when you flip the switch it goes into boost mode. it also has it own onboard moisture sensor that spin up the fan as needed depending on humidity.

https://www.greenwood.co.uk/product/153/unity-cv2gip

freddair commented 3 years ago

Yeah in Germany it's also mandatory in any bathroom or kitchen at least if it has no window.

rojer commented 3 years ago

The core question would be: how would homekit react to the speed control slider: would it "lock" to 50% when between 25% and 75%, and lock to 0% or 100% when outside of the 25-75% range?

1 to 50 would round up to 50, 51 to 100 round up to 100.. the way it works with homekit is, home controller (aka home app) tell you to set it to something like 41, you go - wure enough, ok, then report "set to 50", and it'll update the display. at least that's the way it works with roller shutter positioning. it tells you "set foo X", you nod, then say "foo is now Y", and it's fine :)

Also, anyone wiring this up must be sure not to wire Live to both terminals at the same time.

sure, that can be arranged.

should also support simple on/off for singe output deices (i.e.0 and 1-100 rounding up to 100), shelly 2 and to have additional position at 50.

MichaelVdheeren commented 3 years ago

Maybe this can help: https://github.com/adri/homebridge-itho-cve-eco-rft

jsiegenthaler commented 3 years ago

1 to 50 would round up to 50, 51 to 100 round up to 100..

Wouldn't that would be quite hard to control, as you have to deliberately get the slider under 1% to switch off the fan? That's why I suggested 25%, it gives more of a "snap to the desired location" behaviour. You could do 10% & 90% instead of 25% and 75%. But 1% and 99% is a bit extreme....

Anyway, theoretical for me, as I don't use a shelly dimmer to control my fan ;)

On Mon, 14 Dec 2020 at 16:46, Deomid Ryabkov notifications@github.com wrote:

The core question would be: how would homekit react to the speed control slider: would it "lock" to 50% when between 25% and 75%, and lock to 0% or 100% when outside of the 25-75% range?

1 to 50 would round up to 50, 51 to 100 round up to 100.. the way it works with homekit is, home controller (aka home app) tell you to set it to something like 41, you go - wure enough, ok, then report "set to 50", and it'll update the display. at least that's the way it works with roller shutter positioning. it tells you "set foo X", you nod, then say "foo is now Y", and it's fine :)

Also, anyone wiring this up must be sure not to wire Live to both terminals at the same time.

sure, that can be arranged.

should also support simple on/off for singe output deices (i.e.0 and 1-100 rounding up to 100), shelly 2 and to have additional position at 50.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mongoose-os-apps/shelly-homekit/issues/337#issuecomment-744527303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFC2QVAMVTQJZJVGBQWCBTSUYXL3ANCNFSM4UZYM25A .

timoschilling commented 3 years ago

The HAP has a step value setting for that. So we can say it has step value of 50. Which mean the HomeApp only allows 0%, 50% and 100%, then there is no need to round the value.

Here is an Golang example for that https://github.com/brutella/hc/blob/master/characteristic/rotation_speed.go#L16

rojer commented 3 years ago

step value has to be exactly as specified in the standard, i.e. 1, or controller won't even add the device.

timoschilling commented 3 years ago

If have tested it with the Simulator and it works. image image

rojer commented 3 years ago

i'm pretty sure i've had accessories rejected for incorrect step value before. but ok, this is worth trying when implementing. thanks!

timoschilling commented 3 years ago

Here is how it looks in the HomeApp Image Each time the slider jumps up or down, I released the finger at 25% or 75%.

MichaelVdheeren commented 3 years ago

I managed to create this in homebridge-shelly. Maybe it can help you how the logic works.

https://github.com/MichaelVdheeren/homebridge-shelly/pull/1

step value can be anything. The maxValue should always be 100. If you would instead use 2 and stepvalue of 1 then it would work in the Home App but Siri would return 2% every time you try to set it to 100%. So there is some inconsistency of what Siri returns compared to what the Home App shows. Fixed this by using maxValue of 100 and stepValue of 50.

freddair commented 3 years ago

Any news on this?

zsolt-dev commented 3 years ago

I would too love to skip homebridge and have this functionality directly.

My use case is a ventilation system that is controlled with 3 wires: 1 hot wire - low speed 2 hot wires - medium speed 3 hot wires - hi speed

Ventilation should never be turned off, so the first wire will be hardwired and rest of the two would get connected to shelly 2.5.

It is a bummer that I do not speak C++, so I cannot add this myself.

gentges commented 2 years ago

Any news on this topic? I live in Germany and also have a fan with two speed settings in my bathroom. I would love to have native support for this!

rojer commented 2 years ago

nothing so far

woodsbox commented 2 years ago

This would be great to have!

thirsty-fatman commented 2 years ago

I have a similar question about this post but fan setup is slightly different.

I been apprehensive about adoption of AC ceiling fans into HomeKit as our fan is controlled by Shelly 2.5 and two capacitors on two outputs. Details below:

CBB61 1.5uF+2.5uF 3 Wires AC 250V 50/60Hz Capacitor For Ceiling Fan. This fan has 3 wires. One is for 1.5uF (low), one is for 2.5uF (med) and the third wire is load, and goes to the fan. In this case, high would be 4uF (1.5uF + 2.5uF)

Relay 0 controls the 1.5uF output and Relay 1 controls the 2.5uF output.

State Relay0 Relay1 Off Off Off Low On Off Med Off On Hi On On

Right now, the two relays appear for the fan. Relay 1 is called fan low and relay 2 is called fan medium. There is no high relay or switch but when both low and medium relays are on, then fan is running on high speed.

Is there a way that I can have one control appear in HomeKit for both relays called fan with the settings above for low, medium and high in slider? I can estimate percentages for the slider as above, like 0%, 30%, 70% and 100%.

Many thanks in advance for your insight.

Moderators please advise if posted incorrectly (eg. start a new post or cannot be done.)

thirsty-fatman commented 1 year ago

Is my post relevant in this section or should I move my comment to a new/different thread?

PhaseAngle commented 1 year ago

For rotary capacitor fan controllers the high speed applies power direct to the fan not put the capacitors in series. You need 3 relay outputs. P0v98 or is your fan controlled by a different method?

thirsty-fatman commented 1 year ago

Two of the wires are input and one of the wires is output.

Electricity comes from common into the switch.

Two wires go to the capacitor with the two capacitance values. They are both switched hence the two lines in each of the circuits.

The four way rotary knob (switch) controls whether no capacitance (off,) lower rated capacitance (low,) higher rated capacitance (medium) or both capacitances (high) flow into the load (output) and then onto the fan. The fan will then spin the blades at correct speed.

I am not an electrician but based on my limited knowledge in electronics that's how I understand it.

basroovers commented 2 months ago

This would be awesome to have. I run Homebridge just for this functionality, it would be great to have this natively.

PhaseAngle commented 2 months ago

No that’s a 4 position switch common to off or position 1,2 or 3.