Normal air conditioner to Iot air conditioner

  • Related Categories: DIY, Home IOT

  • Good morning life on the room 

    Next time, in the summer at home fillers Air conditioning on DIY will continue. Very nice 

    The other day I did a heated explanation about the IR Library Lirc… So I tried to register with the LG air conditioner remote to write Irrecord… The IR signal is solitary…. So it was impossible to create a conf file…. Frantically pressing “.” The only…

    LG Remote Controller

    The moment I think of it as a ruined life, thanks to the example provided by the Pigpio library. 

    Let’s find out how I use the silver pigpio of my summer life!! Very nice

    1. Pigpio usage

    In the URL below, you can download an example called IR Record and Playback, which makes it really easy to get an IR signal and export it through Transmitter. 

    http://abyz.me.uk/rpi/pigpio/examples.html

    Just have to install the Pigpio daemon and Python library before that! You can install it by following command. 

    sudo apt-get install pigpio
    # After Enable virtual environment 
    pip install pigpio
    #run pigpio daemon 
    sudo pigpiod

    Once you’ve entered all the commands, you’ll want to Recording the IR signal with the Python code you downloaded, and enter it as shown below. 

    python irrp.py -r -g18 -fir-codes 1 2 3 4

    -R is IR Receiver. -G18 means “GPIO 18” (IR Receiver pin number)-fir-codes means to save Recording data in a file called Ir-codes. The number that follows is the name of the IR signal being Recording! It does not matter if you enter a string. 

    When you run, press the Remote control button that you want to register, and hit the button to confirm that the car is pressed once more. This is the end of registration by pressing twice per button…. I knew this was good. ㅜ ㅜ 

    However, when the remote control is switched off when the power button is pressed and pressed, the IR value seems to be different! That is the same button, but depending on the function to operate the air conditioner, the IR value seems to be different. I need to work on this point. 

    Enter the command below to Play the IR signal. 

    python irrp.py -p -g22 -fir-codes 1

    This command is meant to be the first IR Signal in the Ir-codes file. In my case, it was On the air conditioner 1 and the second time it was Off. This will turn on the actual air conditioning. 

    2. Interlocking with Fauxmo 

    I’m going to add the IR code to the project below, and of course you can already include the code. 

    https://github.com/hog225/echowemoclient

    The first set of files is three. 

    • GpioControl.py
    • Irlib.py
    • Example-minimal.py

    How are you changed? 

    GpioControl.py defined the GPIO port used for IR.

    IR_R = 18
    IR_S = 22

    Irlib.py copied the irrp.py and imported and modified gpioControl. Download the code and compare it with the original file!

    I added a Device called example-minimal.py Aircon and added a routine to the device_handler that I would handle when I entered the command from Alexa. 

    import irlib as ir
    # ------------ Device Name -----------------
    COMPUTER = 'Desktop'
    #(added)
    AIRCON = 'Aircon'
    # ------------------IR BUTTON(added)----------------------
    IR_BUTTON_FILE = "ir-codes"
    AIRCON_ON = 1
    AIRCON_OFF = 2
    class device_handler(debounce_handler):
        """Publishes the on/off state requested,
           and the IP address of the Echo making the request.
        """
        # Device
        TRIGGERS = {COMPUTER: 51999, AIRCON: 52000}
        def act(self, client_address, state, name):
            print "State", state, "on ", name, "from client @"
            
            if name == COMPUTER:
                if state == True:
                    tf.bt_q.put_nowait('True')
                elif state == False:
                    tf.publishMSG(BROKER_IP, BROKER_PORT, MQ_TOPIC, 'Off')        
        # aircon control 추가된 부분----------------------
            elif name == AIRCON:
                if state == True:
                    ir.sendIRSignal(IR_BUTTON_FILE, AIRCON_ON)
                elif state == False:
                    ir.sendIRSignal(IR_BUTTON_FILE, AIRCON_OFF)
            return True

     

     

     

    Then Enable the virtual environment and run the code with the./start.sh! Then I shout to Alexa. 

    Alexa! Find connected Devices

    You’ll find a Device called aircon.

    Then shout. 

    Alexa! Turn on aircon

    This will turn air conditioning on. 

    When you register Device with Alexa, you can use the Alexa APP to turn the air-conditioning on and off at home fillers to your phone. I had a great day at the beach and it was very clean. 

    If you have a pet or want a comfortable environment when you get home or too wet, please refer to this post to have a smart summer life ~ ~ 

    Project Code

    Https://github.com/hog225/echowemoclient

    You may also like...

    댓글 남기기

    이메일은 공개되지 않습니다.