HomeBridge – TP-LINK H200

Tudo Sobre Apple Homekit Fóruns Dúvidas Homebridge Plugins HomeBridge – TP-LINK H200

Este tópico contém 0 resposta, possui 1 voz e foi atualizado pela última vez por  bruno marques 3 meses, 3 semanas atrás.

Visualizando 1 post (de 1 do total)
  • Autor
    Posts
  • #235 Resposta

    As of right now, the only HomeKit-certified smart plug available in Australia is the Elgato Eve Energy – which is bulky, expensive, and uses Bluetooth LE rather than WiFi.

    TP-Link have two WiFi-enabled smart plugs available (HS100 / HS110). While these smart plugs can’t be directly used with HomeKit – by using Homebridge as a software HomeKit bridge, they work great!

    Here’s the recipe:

    Connect Smart Plug to WiFi

    Follow the instructions that came with the smart plug to connect it to WiFi (ensure that this is the same WiFi network that everything else is connected to). Once the smart plug is connected to WiFi, there is no further need for the Kasa app.

    Install (and upgrade) Node.js

    The instructions below assume a Debian/Ubuntu installation – I’m currently using Ubuntu 16.04 LTS – they should also work on a Raspberry Pi. Note: make a point of installing from the official source rather than the distribution’s sources!

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs

    Check which version of Node.js is installed – you’ll need at least 4.3.2 for Homebridge and 6.5 for the TP-Link Smart Home plugin (and quite possibly higher for other plugins).

    nodejs -v

    For me, that command responded with “v4.2.6” – which is way too old. To upgrade to the current stable release:

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable

    Reboot for good measure..

    sudo reboot

    Install Homebridge and TP-Link Smart Home plugin

    sudo apt-get install libavahi-compat-libdnssd-dev
    sudo npm install -g --unsafe-perm homebridge
    sudo npm install -g homebridge-tplink-smarthome

    Create ~/.homebridge/config.json:

    {
        "bridge": {
            "name": "Homebridge",
            "username": "CC:22:3D:E3:CE:30",
            "port": 51826,
            "pin": "031-45-154"
        },
        
        "description": "Homebridge Server",
    
        "platforms": [
            {
                "platform": "TplinkSmarthome",
                "name": "TplinkSmarthome",
    
                "broadcast": "255.255.255.255",
                "devices": [],
                "deviceTypes": [],
                "macAddresses": [],
                "pollingInterval": 10,
    
                "addCustomCharacteristics": true,
                "inUseThreshold": 0,
                "switchModels": ["HS200"],
                "timeout": 5
            }
        ]
    }

    Test Homebridge

    Run Homebridge directly at the command line to test:

    homebridge

    An ascii-art QR code will appear; you can use this code to add Homebridge to HomeKit using the Home app. Ignore warnings about the accessory not being certified..

    As Homebridge starts up, you should see it load the TP-Link Smart Home plugin, then register and initialise the platform. Shortly afterwards, it will detect and add the smart plug(s) automatically – these should appear in the Home app. I then spent 10 minutes being all impressed that I could tell Siri to turn my heater on/off .. you may or may not be similarly enthralled.. 😉

    Create systemd service for Homebridge

    The instructions below assume you used the instructions above to install Node.js and Homebridge – paths may be different if you didn’t.

    Pre-requisites

    The following commands create the service user and directories, then moves the existing configuration into the appropriate locations for starting Homebridge as a service. Finally, set the relevant permissions..:

    sudo useradd -M --system homebridge
    sudo mkdir /var/lib/homebridge
    sudo cp ~/.homebridge/config.json /var/lib/homebridge/
    sudo cp -r ~/.homebridge/persist /var/lib/homebridge
    sudo chmod -R 0777 /var/lib/homebridge

    Systemd config files

    Create /etc/default/homebridge:

    # Defaults / Configuration options for homebridge
    # The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
    HOMEBRIDGE_OPTS=-U /var/lib/homebridge
    
    # If you uncomment the following line, homebridge will log more 
    # You can display this via systemd's journalctl: journalctl -f -u homebridge
    # DEBUG=*

    Create /etc/systemd/system/homebridge.service:

    [Unit]
    Description=Node.js HomeKit Server 
    After=syslog.target network-online.target
    
    [Service]
    Type=simple
    User=homebridge
    EnvironmentFile=/etc/default/homebridge
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
    Restart=on-failure
    RestartSec=10
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target

    Load service

    sudo systemctl daemon-reload
    sudo systemctl enable homebridge
    sudo systemctl start homebridge

    That’s it! You should now have a functioning Homebridge HomeKit bridge, with TP-Link smart plugs connected and working.

Visualizando 1 post (de 1 do total)
Responder a: HomeBridge – TP-LINK H200
Sua informação: