-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathtest-addon.sh
More file actions
42 lines (34 loc) · 1.19 KB
/
Copy pathtest-addon.sh
File metadata and controls
42 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Create a simulated environment for testing the addon
echo "Setting up test environment..."
# Create config directory
mkdir -p ./config
# Set environment variables for the application
export MQTT_BROKER_URL="mqtt://localhost:1883"
export MQTT_CLIENT_ID="hm2mqtt-test"
export MQTT_USERNAME="your_username"
export MQTT_PASSWORD="your_password"
export MQTT_POLLING_INTERVAL="60"
export MQTT_RESPONSE_TIMEOUT="30"
# Set device environment variables
# Replace with your actual device information
export DEVICE_0="HMA-1:your-device-id"
echo "Environment variables set:"
echo "MQTT_BROKER_URL: $MQTT_BROKER_URL"
echo "MQTT_CLIENT_ID: $MQTT_CLIENT_ID"
echo "MQTT_POLLING_INTERVAL: $MQTT_POLLING_INTERVAL seconds"
echo "MQTT_RESPONSE_TIMEOUT: $MQTT_RESPONSE_TIMEOUT seconds"
echo "DEVICE_0: $DEVICE_0"
# Check if node and dist/index.js exist
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed or not in PATH"
exit 1
fi
if [ ! -f "./dist/index.js" ]; then
echo "Error: Application file not found: ./dist/index.js"
echo "Make sure you've built the application with 'npm run build'"
exit 1
fi
# Start the application
echo "Starting hm2mqtt..."
node dist/index.js