### Download and Run Home Assistant Setup Script Source: https://context7.com/mayukh4/linux-android/llms.txt Download and execute the Home Assistant setup script. This process can take a significant amount of time due to Python dependency compilation. After installation, scripts are provided to start and stop the Home Assistant service. ```bash # Download and run the Home Assistant setup curl -O https://raw.githubusercontent.com/mayukh4/linux-anroid/main/setup-homeassistant.sh bash setup-homeassistant.sh # Installation takes 15-45 minutes (compiles Python dependencies) # After installation: bash ~/start-homeassistant.sh # Start HA (first launch takes 5-10 min) bash ~/stop-homeassistant.sh # Stop HA # Access dashboard from any device on your network: # http://:8123 # Find your phone's IP: ip addr show wlan0 | grep 'inet ' ``` -------------------------------- ### Start Home Assistant Source: https://github.com/mayukh4/linux-android/blob/main/README.md Run this command to start the Home Assistant service after installation. ```bash bash ~/start-homeassistant.sh ``` -------------------------------- ### Install Home Assistant Source: https://github.com/mayukh4/linux-android/blob/main/README.md Download and execute the setup script for Home Assistant. This process may take 15-45 minutes as it compiles dependencies within an Ubuntu container. ```bash curl -O https://raw.githubusercontent.com/mayukh4/linux-anroid/main/setup-homeassistant.sh bash setup-homeassistant.sh ``` -------------------------------- ### Install Flask and Run Hello Server Source: https://github.com/mayukh4/linux-android/blob/main/examples/README.md Install the Flask library using pip and then run the hello_server.py script. Access the server via a web browser at http://localhost:5000. ```bash pip install flask python examples/hello_server.py ``` -------------------------------- ### Download and Execute Linux Setup Script Source: https://github.com/mayukh4/linux-android/blob/main/README.md Download the Linux setup script, make it executable, and then run it to install a desktop environment on your Android phone. The script will prompt for choices like the desktop environment and Wine installation. ```bash curl -O https://raw.githubusercontent.com/mayukh4/linux-anroid/main/termux-linux-setup.sh chmod +x termux-linux-setup.sh bash termux-linux-setup.sh ``` -------------------------------- ### Download and Run Linux Desktop Setup Script Source: https://context7.com/mayukh4/linux-android/llms.txt Use these commands to download, make executable, and run the Linux desktop setup script. A wake lock is recommended to prevent Android from terminating the process. The script will prompt for desktop environment and Wine installation. ```bash curl -O https://raw.githubusercontent.com/mayukh4/linux-anroid/main/termux-linux-setup.sh chmod +x termux-linux-setup.sh # Run with wake lock to prevent Android from killing the process termux-wake-lock bash termux-linux-setup.sh # Interactive prompts will ask: # - Desktop environment (1=XFCE4, 2=LXQt, 3=MATE, 4=KDE) # - Wine installation (y/n) # After installation completes (~10-30 minutes): bash ~/start-linux.sh # Start desktop (then open Termux-X11 app) bash ~/stop-linux.sh # Stop desktop ``` -------------------------------- ### Start Linux Desktop Session Source: https://github.com/mayukh4/linux-android/blob/main/README.md After installation, use this command to start your Linux desktop. Ensure you also open the Termux-X11 app on your phone to view the desktop. ```bash bash ~/start-linux.sh ``` -------------------------------- ### Implement Conflict-Safe Package Installation Source: https://context7.com/mayukh4/linux-android/llms.txt A script function to check for package conflicts before installation to prevent system instability. ```bash # The safe_install_pkg function (used internally by setup scripts): # 1. Checks if package is already installed # 2. Reads Conflicts field from apt-cache # 3. Skips package if a conflict exists # 4. Otherwise installs normally # Example usage within the script: safe_install_pkg "vulkan-loader-android" "Vulkan Loader" # If vulkan-loader-generic is installed, this safely skips instead of failing # Manual equivalent for your own scripts: pkg=$1 if dpkg -s "$pkg" &>/dev/null; then echo "Already installed: $pkg" exit 0 fi conflicts=$(apt-cache show "$pkg" 2>/dev/null | grep -i "^Conflicts:" | sed 's/^Conflicts://i') for conflict in $(echo "$conflicts" | tr ',' '\n' | awk '{print $1}'); do if dpkg -s "$conflict" &>/dev/null; then echo "Skipping $pkg - conflicts with $conflict" exit 0 fi done apt-get install -y "$pkg" ``` -------------------------------- ### Auto-launch Linux Desktop on Termux Open Source: https://github.com/mayukh4/linux-android/blob/main/README.md Configure your Termux environment to automatically start the Linux desktop when Termux is opened. Uncomment the line in your .bashrc to enable. ```bash # Uncomment to auto-launch desktop on Termux open # bash ~/start-linux.sh ``` -------------------------------- ### Start SSH Server and Set Password Source: https://github.com/mayukh4/linux-android/blob/main/README.md Run these commands in Termux to start the SSH server and set a password for remote login. Ensure you are in the regular Termux app, not the desktop environment. ```bash # Start the SSH server sshd # Set your Termux password (you'll use this to log in over SSH) passwd ``` -------------------------------- ### Configure and Use SSH Server for Remote Access Source: https://context7.com/mayukh4/linux-android/llms.txt This section covers starting the SSH server, setting a Termux password, finding the phone's IP and username, and connecting from a PC using SSH and SCP. It also includes instructions for auto-starting the SSH server and configuring SSH client settings for easier access. ```bash # Start SSH server on the phone sshd # Set your Termux password (required for SSH login) passwd # Find your phone's IP address ip addr show wlan0 | grep 'inet ' # Output: inet 192.168.1.42/24 ... # Find your Termux username whoami # Output: u0_a123 # Connect from your PC/laptop (port 8022, not 22) ssh u0_a123@192.168.1.42 -p 8022 # Auto-start SSH when Termux opens echo 'sshd 2>/dev/null' >> ~/.bashrc # File transfer with SCP scp -P 8022 myfile.txt u0_a123@192.168.1.42:~/ # Upload to phone scp -P 8022 u0_a123@192.168.1.42:~/somefile.txt ./ # Download from phone ``` ```bash # On your PC, add to ~/.ssh/config: cat >> ~/.ssh/config << 'EOF' Host myphone HostName 192.168.1.42 User u0_a123 Port 8022 EOF # Now connect with just: ssh myphone # Set up passwordless authentication ssh-keygen -t ed25519 # Generate key pair (if needed) ssh-copy-id -p 8022 u0_a123@192.168.1.42 # Copy public key to phone ``` -------------------------------- ### Upgrade Termux Packages Source: https://github.com/mayukh4/linux-android/blob/main/README.md Before running the setup script, upgrade your Termux packages to prevent potential crashes. `termux-wake-lock` ensures the process isn't interrupted by Android killing Termux when the screen turns off. ```bash termux-wake-lock pkg upgrade -y ``` -------------------------------- ### Integrate TP-Link Kasa Devices with Home Assistant Source: https://context7.com/mayukh4/linux-android/llms.txt Instructions for adding TP-Link Kasa smart devices to Home Assistant by manually entering their IP addresses, as mDNS auto-discovery is disabled on Android 10+. The steps guide users to find the IP in the Kasa app and then add it via the Home Assistant integration settings. ```bash # 1. Find your Kasa device IP in the Kasa mobile app: # Device Settings → Device Info → IP Address (e.g., 192.168.1.100) # 2. In Home Assistant dashboard (http://:8123): # Settings → Devices & Services → + Add Integration # Search: "TP-Link Kasa Smart" # Enter device IP when prompted ``` -------------------------------- ### Keep SSH Running Persistently Source: https://github.com/mayukh4/linux-android/blob/main/README.md Add this command to your `~/.bashrc` file in Termux to ensure the SSH server automatically starts whenever Termux is opened. This prevents SSH from stopping when Termux is closed. ```bash echo 'sshd 2>/dev/null' >> ~/.bashrc ``` -------------------------------- ### Configure Tuya Integration Source: https://context7.com/mayukh4/linux-android/llms.txt Steps for setting up Tuya cloud integration within Home Assistant. ```bash # 1. Create Tuya IoT developer account at https://iot.tuya.com # 2. Create Cloud Project → Select data center region → Add "Smart Home" API # 3. Go to Devices → Link Tuya App Account → Scan QR with Smart Life app # 4. Note your Access ID and Access Secret # In Home Assistant dashboard: # Settings → Devices & Services → + Add Integration → "Tuya" # Enter: # - Access ID: your_tuya_access_id # - Access Secret: your_tuya_access_secret # - Country Code: e.g., "1" for USA # Tuya uses cloud API - works even without local network access ``` -------------------------------- ### Deploy Flask Demo Server Source: https://context7.com/mayukh4/linux-android/llms.txt A simple Flask application that displays system information and uptime. ```python #!/usr/bin/env python3 # examples/hello_server.py - Demo Flask server showing system info from flask import Flask import platform import os app = Flask(__name__) def get_device_info(): """Grab system info to display.""" info = {} info["hostname"] = platform.node() info["arch"] = platform.machine() info["python"] = platform.python_version() info["cpu_cores"] = str(os.cpu_count() or "N/A") # Read uptime from /proc try: with open("/proc/uptime") as f: secs = int(float(f.read().split()[0])) hrs, rem = divmod(secs, 3600) mins, secs = divmod(rem, 60) info["uptime"] = f"{hrs}h {mins}m {secs}s" except Exception: info["uptime"] = "N/A" return info @app.route("/") def home(): info = get_device_info() return f"

Hello from Android!

Arch: {info['arch']}, Python: {info['python']}

" if __name__ == "__main__": # Run the server (accessible from local network) pip install flask python examples/hello_server.py # Open Firefox and visit http://localhost:5000 app.run(host="0.0.0.0", port=5000) ``` -------------------------------- ### Configure SSH Client Source: https://github.com/mayukh4/linux-android/blob/main/README.md Add this configuration to your PC's `~/.ssh/config` file to simplify SSH connections to your phone. This allows you to use a short alias like 'myphone' instead of the full command. ```bash Host myphone HostName 192.168.1.42 User u0_a123 Port 8022 ``` -------------------------------- ### Configure GPU Environment Settings Source: https://context7.com/mayukh4/linux-android/llms.txt This section shows how the GPU environment is automatically configured and saved to `~/.config/linux-gpu.sh`. It displays default settings for Mesa and Vulkan, and explains how to manually edit the file or force software rendering for debugging. ```bash # Default GPU environment (created automatically) cat ~/.config/linux-gpu.sh # Contents: # export MESA_NO_ERROR=1 # export MESA_GL_VERSION_OVERRIDE=4.6 # export MESA_GLES_VERSION_OVERRIDE=3.2 # export GALLIUM_DRIVER=zink # export MESA_LOADER_DRIVER_OVERRIDE=zink # export TU_DEBUG=noconform # export MESA_VK_WSI_PRESENT_MODE=immediate # export ZINK_DESCRIPTORS=lazy # For Adreno GPUs, also includes: # export VK_ICD_FILENAMES=$PREFIX/share/vulkan/icd.d/freedreno_icd.aarch64.json # Custom tweaks - edit the file: nano ~/.config/linux-gpu.sh # Force software rendering (for debugging) export GALLIUM_DRIVER=llvmpipe # Enable Mesa debug output export MESA_DEBUG=1 ``` -------------------------------- ### Connect with Simplified SSH Alias Source: https://github.com/mayukh4/linux-android/blob/main/README.md After configuring your SSH client, you can connect to your phone using the alias defined in your SSH config file. ```bash ssh myphone ``` -------------------------------- ### Manage Background Home Assistant Processes Source: https://context7.com/mayukh4/linux-android/llms.txt Commands to keep Home Assistant running persistently in Termux. ```bash # Option 1: Run in background with nohup termux-wake-lock nohup bash ~/start-homeassistant.sh > ~/hass.log 2>&1 & # Check logs tail -f ~/hass.log # Option 2: Auto-start on Termux launch echo 'termux-wake-lock && nohup bash ~/start-homeassistant.sh > ~/hass.log 2>&1 &' >> ~/.bashrc # Stop background HA bash ~/stop-homeassistant.sh # Or manually: pkill -f "hass" ``` -------------------------------- ### Copy File to Phone via SCP Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use the SCP command to copy a file from your PC to your phone. Specify the destination path on the phone using `~/` for the home directory. ```bash scp -P 8022 myfile.txt u0_a123@192.168.1.42:~/ ``` -------------------------------- ### Connect via SSH Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use this command to connect to your phone via SSH from your PC or laptop. Replace 'your-termux-username' with your actual Termux username and the IP address accordingly. Port 8022 is the default for Termux SSH. ```bash ssh your-termux-username@192.168.1.42 -p 8022 ``` -------------------------------- ### Copy File from Phone via SCP Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use the SCP command to copy a file from your phone to your PC. Specify the source path on the phone and the destination path on your PC. ```bash scp -P 8022 u0_a123@192.168.1.42:~/somefile.txt ./ ``` -------------------------------- ### Force Software Rendering in Linux-Android Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use this to force software rendering for debugging purposes. This is useful when encountering graphics-related issues. ```bash # Force software rendering (for debugging) export GALLIUM_DRIVER=llvmpipe ``` -------------------------------- ### Generate SSH Key Pair Source: https://github.com/mayukh4/linux-android/blob/main/README.md Generate an SSH key pair on your PC for passwordless login. This is a prerequisite for setting up SSH key authentication. ```bash ssh-keygen -t ed25519 ``` -------------------------------- ### Trigger Home Assistant Service via REST API Source: https://context7.com/mayukh4/linux-android/llms.txt Use this curl command to programmatically turn on entities. Requires a valid long-lived access token. ```bash curl -X POST http://192.168.1.42:8123/api/services/light/turn_on \ -H "Authorization: Bearer YOUR_LONG_LIVED_TOKEN" \ -H "Content-Type: application/json" \ -d '{"entity_id": "light.living_room"}' ``` -------------------------------- ### Stop Home Assistant Source: https://github.com/mayukh4/linux-android/blob/main/README.md Run this command to stop the Home Assistant service. ```bash bash ~/stop-homeassistant.sh ``` -------------------------------- ### Enable Mesa Debug Output in Linux-Android Source: https://github.com/mayukh4/linux-android/blob/main/README.md Enable detailed debug output from Mesa, the open-source graphics driver stack. This can help diagnose rendering problems. ```bash # Enable Mesa debug output export MESA_DEBUG=1 ``` -------------------------------- ### Access Home Assistant Dashboard Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use this URL format in a browser on the same WiFi network to access the Home Assistant interface. ```text http://:8123 ``` -------------------------------- ### Maintain Background Execution Source: https://github.com/mayukh4/linux-android/blob/main/README.md Commands to prevent Android from killing the Termux process, ensuring Home Assistant remains active. ```bash # Option 1: Run in background with nohup termux-wake-lock nohup bash ~/start-homeassistant.sh > ~/hass.log 2>&1 & # Option 2: Auto-start on Termux launch (add to ~/.bashrc) echo 'termux-wake-lock && nohup bash ~/start-homeassistant.sh > ~/hass.log 2>&1 &' >> ~/.bashrc ``` -------------------------------- ### Find Phone IP Address Source: https://github.com/mayukh4/linux-android/blob/main/README.md Execute this command in Termux to retrieve the local IP address of the device. ```bash ip addr show wlan0 | grep 'inet ' ``` -------------------------------- ### Find Phone's IP Address Source: https://github.com/mayukh4/linux-android/blob/main/README.md Execute this command in Termux to find your phone's IP address on the wlan0 network interface. The IP address is needed for SSH connections. ```bash ip addr show wlan0 | grep 'inet ' ``` -------------------------------- ### Stop Linux Desktop Session Source: https://github.com/mayukh4/linux-android/blob/main/README.md Use this command to gracefully shut down your Linux desktop session. ```bash bash ~/stop-linux.sh ``` -------------------------------- ### Copy SSH Public Key to Phone Source: https://github.com/mayukh4/linux-android/blob/main/README.md Copy your generated SSH public key to your Android phone. This allows passwordless SSH connections from your PC to your phone. ```bash ssh-copy-id -p 8022 u0_a123@192.168.1.42 ``` -------------------------------- ### Override OpenGL Version in Linux-Android Source: https://github.com/mayukh4/linux-android/blob/main/README.md Force a specific OpenGL version for compatibility or testing. Useful if applications require a different version than what's natively supported. ```bash # Change OpenGL version override export MESA_GL_VERSION_OVERRIDE=3.3 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.