Air
Conditioner Controller Using Fuzzy Logic In Python
Hello friends, Today our new tutorial is on Fuzzy Logic which will be used by Air Conditioner Controller in Python Programming Language.For
this we are going to use a library hvac-ir to control the air conditioner devices.
Let’s
start our tutorial :-
hvac-ir
Introduction
This is a python port of the great Arduino heatpumpir
library which is used to control the air conditioner devices.
Supported
devices of hvac-ir :-
·
Daikin
·
Carrier
·
Fuego
·
Fujitsu
·
Hisense
·
Hitachi
·
Hyundai
Install
In System
$ pip install hvac_ir
Example
Demo :-
import hvac_ir
Sender =
hvac_ir.get_sender('Fuego')
if Sender is None:
print("No
Sender")
exit(2)
AC = Sender()
AC.send(Sender.POWER_OFF,
Sender.MODE_HEAT, Sender.FAN_AUTO, 24, Sender.VDIR_SWING_DOWN,
Sender.HDIR_SWING, False)
duration =
AC.get_durations()
my_ir_sender.transmit(duration)
Full Code
Full
programming code in python is given and show the sending codes in the codes
which is given below :-
import hvac_ir
import binascii
x = 32.6
token = 0x26
def fun_1(durations):
display = bytearray()
display .append(token)
display .append(0)
display
.append(len(durations) % 256)
display
.append(int(len(durations) / 256))
for d in durations:
n = int(round(d / x))
if n > 255:
display .append(0)
display .append(int(n /
256))
display .append(num % 256)
display .append(0x0d)
display .append(0x05)
display .append(0x00)
display .append(0x00)
display .append(0x00)
display .append(0x00)
return display
def
format_durations(data):
result = ''
for i in range(0,
len(data)):
if len(result) > 0:
result += ''
result += ('+' if i % 2 ==
0 else '-') + str(data[i])
return result
if __name__ == '__main__':
Sender =
hvac_ir.get_sender('Fuego')
if Sender is None:
print("No
Sender")
exit(2)
AC = Sender()
AC.send(Sender.POWER_OFF,
Sender.MODE_HEAT, Sender.FAN_AUTO, 24, Sender.VDIR_SWING_DOWN,
Sender.HDIR_SWING, False)
duration =
AC.get_durations()
my_ir_sender.transmit(duration)
print(format_durations(duration))
If you liked this post, then please distribute it among your friend circle or on the social media platforms you use.
Thank you Guys and Good Bye...
Thank you Guys and Good Bye...
Keep learning,
0 Comments