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.
- 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.
Before starting, you must generate credentials to listen to the FCM notifications:
- Run the following command in your local PC's terminal:
npx @liamcottle/rustplus.js fcm-register
- Follow the on-screen instructions. This will print out an
androidIdandsecurityToken. Keep these values handy for configuration.
- Navigate to Settings → Add-ons → Add-on Store in your Home Assistant.
- Click the three dots (⋮) menu in the top right corner and select Repositories.
- Add this repository URL:
https://github.com/Grovvik/rustplus-homeassistant - Click Add and close the dialog.
- Find Rust+ Bridge in the Add-on Store (you can search for it, or reload the page if it doesn't show up immediately).
- Click on it and press Install.
- Wait for the installation to complete.
- Go to the Configuration tab.
- Fill in the options:
- FCM Android ID: The
androidIdfrom the prerequisite step. - FCM Security Token: The
securityTokenfrom the prerequisite step. - MQTT URL: Your MQTT broker address (defaults to
mqtt://core-mosquitto:1883if using the official HA Mosquitto integration). - MQTT Username & Password: (Optional) Credentials for your MQTT broker.
- FCM Android ID: The
- Click Save.
- Go to the Info tab.
- Click Start.
- Check the Log tab to ensure everything is running correctly.
If you prefer to run the bridge on a separate server manually using Node.js:
- Node.js (v16 or higher recommended).
- MQTT Broker (e.g., Mosquitto).
git clone https://github.com/Grovvik/rustplus-homeassistant.git
cd rustplus-homeassistant
npm installGenerate your credentials:
npx @liamcottle/rustplus.js fcm-registerThis will generate a rustplus.config.json file in your root directory.
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"
}
}node index.js- 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. - Add Devices: To add a Smart Switch, Alarm, or Storage Monitor, simply use the Pair button on the device in-game.
- Home Assistant: The device will automatically appear in Home Assistant under the MQTT integration.
This project relies on the following open-source libraries:
- @liamcottle/rustplus.js - The core library for interacting with Rust+ servers.
- @liamcottle/push-receiver - Used to listen for Google FCM notifications.
- mqtt - For communication with the Home Assistant MQTT broker.
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.