Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust+ to Home Assistant via MQTT

Open your Home Assistant instance and show the add-on store of your Supervisor.

This script acts as a bridge between the Rust mobile app ecosystem (Rust+) and Home Assistant. It allows you to monitor and control in-game devices like Smart Switches, Alarms, and Storage Monitors directly from your smart home dashboard.

Features

  • Auto-Discovery: Automatically adds devices to Home Assistant via MQTT Discovery.
  • Smart Switches: Toggle switches in-game from Home Assistant.
  • Smart Alarms: Receive notifications in Home Assistant when your in-game alarms are triggered.
  • Storage Monitors: Track item counts in boxes/tool cupboards.
  • FCM Integration: Automatically handles server and entity pairing when you click "Pair" in the Rust pause menu or on a device.

Method 1: Install as a Home Assistant Add-on (Recommended)

Prerequisite: Get FCM Credentials

Before starting, you must generate credentials to listen to the FCM notifications:

  1. Run the following command in your local PC's terminal:
    npx @liamcottle/rustplus.js fcm-register
  2. Follow the on-screen instructions. This will print out an androidId and securityToken. Keep these values handy for configuration.

Step 1: Add the Repository

  1. Navigate to SettingsAdd-onsAdd-on Store in your Home Assistant.
  2. Click the three dots (⋮) menu in the top right corner and select Repositories.
  3. Add this repository URL: https://github.com/Grovvik/rustplus-homeassistant
  4. Click Add and close the dialog.

Step 2: Install the Add-on

  1. Find Rust+ Bridge in the Add-on Store (you can search for it, or reload the page if it doesn't show up immediately).
  2. Click on it and press Install.
  3. Wait for the installation to complete.

Step 3: Configure the Add-on

  1. Go to the Configuration tab.
  2. Fill in the options:
    • FCM Android ID: The androidId from the prerequisite step.
    • FCM Security Token: The securityToken from the prerequisite step.
    • MQTT URL: Your MQTT broker address (defaults to mqtt://core-mosquitto:1883 if using the official HA Mosquitto integration).
    • MQTT Username & Password: (Optional) Credentials for your MQTT broker.
  3. Click Save.

Step 4: Start the Add-on

  1. Go to the Info tab.
  2. Click Start.
  3. Check the Log tab to ensure everything is running correctly.

Method 2: Manual Node.js Setup

If you prefer to run the bridge on a separate server manually using Node.js:

Prerequisites

  1. Node.js (v16 or higher recommended).
  2. MQTT Broker (e.g., Mosquitto).

1. Clone and Install

git clone https://github.com/Grovvik/rustplus-homeassistant.git
cd rustplus-homeassistant
npm install

2. Register FCM (Rust+ Credentials)

Generate your credentials:

npx @liamcottle/rustplus.js fcm-register

This will generate a rustplus.config.json file in your root directory.

3. Configure MQTT

Open rustplus.config.json and add your mqtt credentials so it matches this structure:

{
  "fcm_credentials": {
    "gcm": {
      "androidId": "your_id",
      "securityToken": "your_token"
    }
  },
  "mqtt": {
    "url": "mqtt://MQTT_BROKER_IP:1883",
    "username": "your_username",
    "password": "your_password"
  }
}

4. Run the Script

node index.js

How to Use

  1. Link Server: Open Rust, go to the Esc menu -> Rust+, and click Pair Service. The script/add-on will catch the notification, save the server details to server.json, and connect.
  2. Add Devices: To add a Smart Switch, Alarm, or Storage Monitor, simply use the Pair button on the device in-game.
  3. Home Assistant: The device will automatically appear in Home Assistant under the MQTT integration.

Libraries Used

This project relies on the following open-source libraries:

License

This repository is licensed under the MIT License. Feel free to use, modify, and distribute it as you wish.

Disclaimer: This is an unofficial tool and is not affiliated with Facepunch Studios. Use at your own risk.

About

Integrating smart devices from the game Rust into Home Assistant

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages