SirGoodenough / HA_Blueprints

🧯 My Collection of Automation and Script Blueprints for Home Assistant 🧯
Other
132 stars 22 forks source link

[FR] Temp off variable for fan blueprint #11

Closed cappadanna closed 1 year ago

cappadanna commented 1 year ago

Would it be possible to add an offset for the off temperature? For example: I set the desired temp to 23 degrees. When my HVAC starts it cools down my temp sensors so quickly that it turns off after a very short time. And then starts again and so on. It would be great if it could set it to turn off at maybe 22.5 and then start again at 23. Like a hysteresis.

This blueprint uses separate temp off but can’t get it to work:

https://community.home-assistant.io/t/multi-speed-fan-control-based-on-temperature/552322

SirGoodenough commented 1 year ago

There is a facility in the blueprint for this already.


temp_gap/name: Temp Hysteresis
    (#4) This keeps the fan from speed cycling too often. (Let''s
    call it Hysterisis)

https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/AutoFanControl.md#-%EF%B8%8F-extended-information

Try adjusting that variable. I think I have mine set to 2.5.

cappadanna commented 1 year ago

Yes i tried that but as I understand “It basically move the input_number set point by the amount you pick” so if I set the fan on to say 20 and the temp gap to 1 it turns on the fan at 21 but it still turns it off at 21. I would like it to turn of at 19.

SirGoodenough commented 1 year ago

My thought is that the sensor that tells the fan the room temperature is in the path of the AC cold air. It should be out of the direct cold air on the the general room for best results. The sensor for controlling the AC and the sensor for controlling the fan speed should be separate sensors in different places in the room.

Aside from that, I have an idea that might work. I'll play with it to see. It will still short cycle and not operate as intended if the sensor is in the cold air stream.

cappadanna commented 1 year ago

I’m not sure I understand what you mean by two sensors. Isn’t the sensor for ac and sensor for fan speed the same thing? I only have one temp sensor (and that is out of the direct cold air) that gives the blueprint the temp information.

Maybe an adjustable minimum running time could be an alternative so it doesn’t toggle too fast?

SirGoodenough commented 1 year ago

The design of the BP is that there is a sensor,

    room_temp_now:
    name: Room Temperature Sensor

that tracks the room temp to control the fan.

Adding control of an ac or heating unit is meant to happen with your own code or my sample code, both having their own sensor controlling their own device. So I'm not sure how you are using this BP, but that is the intention and works for that, controlling a single fan's speed based on the room temp.

Does this describe what you are doing?

I have no problem with using it for other things, but I don't want to compromise the intended purpose to make it do something else. This would be the case where you take my code as a basis and form youe own BP. I have no problem with that.

I believe since I already have access to the fan entity or fanspeed topic, I'll be able to check if the fan is on, and if it is give you an input as to the offset positive or negative that needs to happen before it turns off. However this could interfere with medium fanspeed, so it starts to get complicated. If the device changing the temp of the air has it's own sensor, then changing the offset on this device works perfectly as is. IE you are asking to fundamentally change the purpose of the BP.

Here's an example of how it was intended to be used, if this helps: (This is the MQTT one, but they are much the same in operation.)

https://github.com/SirGoodenough/Home-Assistant-Config/blob/82afd03bd5d02e502402ff7c5228a65a328687a3/automation2/Bedroom_A2.yaml#L41

I will still go thru and add the shutoff temp if the fan is running. It may be a short time but it is on my list..

cappadanna commented 1 year ago

My AC is just basically a fan blowing cold air that is controlled by a zigbee dimmer putting out 0-10v. It has no temp sensor of its own so it acts like a regular fan.

It might be because I'm cooling down the room faster using cold air that makes it cycle on and off more often. Also, my zigbee temp sensor sends updates at a change of 0.1 degrees so it doesn't take much to trigger the blueprint.

SirGoodenough commented 1 year ago

Updated in Nuggets Branch, TBR soon.

cappadanna commented 1 year ago

Thanks! I tried the nuggets version and it turns off at set room_set_temp_val + temp_off_offset. However, it seems to start the fan at the same temp (room_set_temp_val + temp_off_offset). I tried tracing the automation and this is what I could find. I had set the room_set_temp_val to 22.5, temp_off_offset to -0.3 and the fan seems to start at 22.2.

(I might be doing something wrong here since I'm new at this )

IMG_7229 IMG_7230

SirGoodenough commented 1 year ago

I'll work on debugging this...

'Thought' I had it... Was about to release everything.

Glad you checked, I didn't think of pinging you to test it. Oops...

Edit---> OK, so now it's later than when I sent the message below.

The only place the temp off offset appears in the control templates is when deciding when to turn the fan off. The turn the fan on decision is the setting you put in for the set temp alone, and it stays on low until it hits the gap 1 to 2 trigger level for medium speed.

But I see a problem with my logic. If you set this off thing positive it will actually affect the on temp because it will try to turn on and then turn itself right back off, so this feature is not going to work setting the offset positive. So going to adjust that.

Looking at the settings you have set, you have -0.3 for the turnoff and +0.3 for the difference between low speed and medium & 0.3 for medium to high speed, so there is no way to tell what is going on. You must have changed the input number settings to allow this, and the minimum was set higher than that for the 2 gaps in the original. Everything is set within 1 degree and all in increments of 0.3. For testing, set a larger gap and in odd increments so you can actually tell when different things are triggered. Also look at the traces.

This is not intended to run a single speed fan, but I guess you could try setting medium and high to like 100 so they never get triggered. Then the set temp for low speed is the only one that will be used.

Bottom line, please read the next comment and answer that.

SirGoodenough commented 1 year ago

(I might be doing something wrong here since I'm new at this )

I haven't looked at the BP yet, and I will, but I was looking at your settings. Based on that I am wondering if you are using this BP as intended and if you are not, is that the actual problem.

The intention of this BP as written is to change the speed of a multi speed fan based on how far the sensed room temperature is from the set desired temperature. There is sample code to plug into the provided action statements to help you sync this with a cooling unit such as a window air conditioner.

The intention was never to control thing within tenths of a degree, the feedback loop with the HA timing and the accuracy of the temperature sensors will make this oscillate radically if you try to run it that tight.

Please describe your set-up and maybe I can help come up with something that better fits your situation.

cappadanna commented 1 year ago

Please describe your set-up and maybe I can help come up with something that better fits your situation.

I have a "fan coil" (a fan blowing through a coil cooled by water flowing through) https://www.sabiana.it/en/products/skystar-skystar-ecm/fan-coils to cool down my house

It has an EC motor that is controlled using a 0-10 zigbee controller so I can control the fan speed from 0-100%. I have the controller configured as a fan in Home Assistant. I have it set in your BP to 33, 66 and 100% for lo, med and hi.

For temperature sensing I use 3 Aqara temp sensors in three different rooms and use a mean value helper to smooth the temperature out and combine them into one. The BP works great when turning the fan on and also changing speed from say lo to med. The temperature doesn't vary that fast. Using temp gap of 0.3 degrees between the speeds has been working great to keep an even indoor temperature.

If it changes between lo and med say every five minutes, that is no problem (and expected). However, to avoid it turning on and off too often, it would be great if it could cool down a bit below the set temp (as a hysteresis). Both to reduce unnecessary starts of the fan (and also the pump pumping water through the coil) but also because it makes certain noises when turning on every time :)

If not possible to use a temp off offset, maybe a minimum running time timer would work?

SirGoodenough commented 1 year ago

So this also setting house temperature as well as fan speed? This may be where the issue is. I would have something like generic thermostat controlling the actual house temperature, then this running on top as a fan speed controller as it was intended. Generic thermostat has all the fancy settings and hysteresis and all that built in. This simple code trying to control 4 fan speeds within 1 degree is not going to work well, it isn't smart enough.

https://www.home-assistant.io/integrations/generic_thermostat/

If you want to continue as you are, I would set the turnoff to a negative number that is not an increment of 0.3 (maybe -1) so you can actually see when it is kicking in and watch the traces so you can get a better feel on how it's running. 0.3/0.3 & shutoff at -0.3 is not going to perform well.

There are 2 places you can add your own custom actions and the new version in Nugget, soon to be released, has a user controlled condition statement where you could set timers and such for minimum cycle time, but you are going about this the hard way IMHO.

SirGoodenough commented 1 year ago

Merged into master.

cappadanna commented 1 year ago

So this also setting house temperature as well as fan speed? This may be where the issue is. I would have something like generic thermostat controlling the actual house temperature, then this running on top as a fan speed controller as it was intended. Generic thermostat has all the fancy settings and hysteresis and all that built in. This simple code trying to control 4 fan speeds within 1 degree is not going to work well, it isn't smart enough.

I’d like to see it as a fan blowing cold air that starts (and changes speed) depending on the temperature. It produces no heat at all.

Controlling a regular fan and having it run at different speeds depending on room temperature is very similar but I suppose what you mean is that a regular fan does not produce cold air.

The thing is your BP works so great as a thermostat for keeping a steady temperature in the summer 😊

https://www.home-assistant.io/integrations/generic_thermostat/

If you want to continue as you are, I would set the turnoff to a negative number that is not an increment of 0.3 (maybe -1) so you can actually see when it is kicking in and watch the traces so you can get a better feel on how it's running. 0.3/0.3 & shutoff at -0.3 is not going to perform well.

I will try with different settings. I just can’t understand why it is triggered by set temperature + offset temp. Your code seem correct to me

There are 2 places you can add your own custom actions and the new version in Nugget, soon to be released, has a user controlled condition statement where you could set timers and such for minimum cycle time, but you are going about this the hard way IMHO.

I really appreciate you doing this! Thank you

SirGoodenough commented 1 year ago

The new version is released just now as master.

Another thing you could do is take my cone and make an automation from it, then tweak it as you feel you need to.

Since the original request is merged into master, I want to close this.