Comments (4)
Hi, what's the fix you are making ?
from ad-autofanspeed.
from ad-autofanspeed.
Hello,
I was add this end of code but it prints all the print ( my setup have a lot of fan),
Thank you in advance to check in an system with less fan !
the code is here :
'''
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: doria
#
# Created: 06/11/2021
# Copyright: (c) doria 2021
# Licence: <your licence>
#-------------------------------------------------------------------------------
def initialize(self):
# DEFAULTS
self.debug = True;
self.low = 67
self.medium = 69
self.high = 73
self.medium = 70
self.high = 72
self.offset = 0
self.start = datetime.strptime("21:00:00", '%H:%M:%S').time()
self.end = datetime.strptime("09:30:00", '%H:%M:%S').time()
def temperature_change(self, entity, attribute, old, new, kwargs):
if self.is_time_okay(self.start, self.end):
room_temperature = float(new)
fan_speed = self.get_target_fan_speed(room_temperature)
self.call_service("fan/set_speed", entity_id = self.fan, speed = fan_speed)
fan_speed_percentage = self.get_target_fan_speed(room_temperature)
self.call_service("fan/set_percentage", entity_id = self.fan, percentage = fan_speed_percentage)
def get_target_fan_speed(self, room_temperature):
# if sun is above horizon, then add offset
sun_above_horizon = self.get_state(self.sun) == "above_horizon"
offset = self.offset if sun_above_horizon else 0
fan_speed = "off"
fan_speed_percentage = 0
if room_temperature < self.low + offset:
fan_speed = "off"
elif room_temperature >= self.low + offset and room_temperature < self.medium + offset:
fan_speed = "low"
elif room_temperature >= self.medium + offset and room_temperature < self.high + offset:
fan_speed = "medium"
elif room_temperature >= self.high + offset:
fan_speed = "high"
if room_temperature >= self.low + offset: fan_speed_percentage = 25
if room_temperature >= self.medium + offset: fan_speed_percentage = 50
if room_temperature >= self.high + offset: fan_speed_percentage = 100
self.debug_log(f"AUTO FAN SPEED: {str(room_temperature)}/{fan_speed}")
if sun_above_horizon: self.debug_log(f" (SUN OFFSET)")
self.debug_log(f"AUTO FAN SPEED: {str(room_temperature)}/{fan_speed_percentage}%" + (" (SUN OFFSET)" if sun_above_horizon else ""))
return fan_speed
return fan_speed_percentage
def hvac_daily_shut_off(self, kwargs):
self.call_service("fan/turn_off", entity_id = self.fan)
self.debug_log("FAN AUTO OFF")
def is_time_okay(self, start, end):
current_time = datetime.now().time()
if (start < end):
return start <= current_time and current_time <= end
else:
return start <= current_time or current_time <= end
def debug_log(self, message):
if self.debug:
self.log(message)
if fan_speed_percentage := 25:
print("the fan is slow and cool")
if fan_speed_percentage := 50:
print("the fan is moderate")
if fan_speed_percentage := 100:
print("the fan is hight and hot")'''
Have a nice evening from the france it is eighteen past height and the sky is fallen,
Regards.
Azaretdodo.
from ad-autofanspeed.
Hello,
I was add this end of code but it prints all the print ( my setup have a lot of fan),
thank you in advance to check by your side,
the code is here :
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: doria
#
# Created: 06/11/2021
# Copyright: (c) doria 2021
# Licence: <your licence>
#-------------------------------------------------------------------------------
def initialize(self):
# DEFAULTS
self.debug = True;
self.low = 67
self.medium = 69
self.high = 73
self.medium = 70
self.high = 72
self.offset = 0
self.start = datetime.strptime("21:00:00", '%H:%M:%S').time()
self.end = datetime.strptime("09:30:00", '%H:%M:%S').time()
def temperature_change(self, entity, attribute, old, new, kwargs):
if self.is_time_okay(self.start, self.end):
room_temperature = float(new)
fan_speed = self.get_target_fan_speed(room_temperature)
self.call_service("fan/set_speed", entity_id = self.fan, speed = fan_speed)
fan_speed_percentage = self.get_target_fan_speed(room_temperature)
self.call_service("fan/set_percentage", entity_id = self.fan, percentage = fan_speed_percentage)
def get_target_fan_speed(self, room_temperature):
# if sun is above horizon, then add offset
sun_above_horizon = self.get_state(self.sun) == "above_horizon"
offset = self.offset if sun_above_horizon else 0
fan_speed = "off"
fan_speed_percentage = 0
if room_temperature < self.low + offset:
fan_speed = "off"
elif room_temperature >= self.low + offset and room_temperature < self.medium + offset:
fan_speed = "low"
elif room_temperature >= self.medium + offset and room_temperature < self.high + offset:
fan_speed = "medium"
elif room_temperature >= self.high + offset:
fan_speed = "high"
if room_temperature >= self.low + offset: fan_speed_percentage = 25
if room_temperature >= self.medium + offset: fan_speed_percentage = 50
if room_temperature >= self.high + offset: fan_speed_percentage = 100
self.debug_log(f"AUTO FAN SPEED: {str(room_temperature)}/{fan_speed}")
if sun_above_horizon: self.debug_log(f" (SUN OFFSET)")
self.debug_log(f"AUTO FAN SPEED: {str(room_temperature)}/{fan_speed_percentage}%" + (" (SUN OFFSET)" if sun_above_horizon else ""))
return fan_speed
return fan_speed_percentage
def hvac_daily_shut_off(self, kwargs):
self.call_service("fan/turn_off", entity_id = self.fan)
self.debug_log("FAN AUTO OFF")
def is_time_okay(self, start, end):
current_time = datetime.now().time()
if (start < end):
return start <= current_time and current_time <= end
else:
return start <= current_time or current_time <= end
def debug_log(self, message):
if self.debug:
self.log(message)
def self():
case == self.low or self.medium or self.high
match == self.low.print("the fan is slow and cool")
match == self.medium.print("the fan is moderate and temperate")
match == self.high.print("the fan is hight and hot")
Have a nice morning from the france it is eleven past three and the sun is shining,
Regards.
Azaretdodo.
from ad-autofanspeed.
Related Issues (8)
- When temperature changes at the same moment of end time the fan never turns off HOT 2
- Four Speed Fans, 25%-50%-75%-100% HOT 5
- the final script
- Feature Request: Turn the fan off temporarly when the HVAC system is running HOT 2
- To Celsius? HOT 3
- Pause script HOT 5
- Due to HA FAN updates, low speed is actually medium on 3 speed switches
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ad-autofanspeed.