Before installing, ensure you have:
- Home Assistant 2024.1.0 or newer
- Bluetooth Adapter configured in Home Assistant
- Python 3.11+ (usually already installed with HA)
- SwitchBot Meter device nearby
- Go to Settings → Devices & Services
- Check that Bluetooth integration is installed and working
- Verify your adapter is shown as "Active" or "Passive"
If Bluetooth is not set up:
- Click Add Integration
- Search for "Bluetooth"
- Follow the setup wizard
-
Download the Integration
- Download this repository as a ZIP file
- Extract it to a temporary location
-
Copy Files
# Navigate to your Home Assistant config directory cd /config # Create custom_components directory if it doesn't exist mkdir -p custom_components # Copy the integration cp -r /path/to/extracted/switchbot_meter_time_sync custom_components/
-
Verify Structure Your directory should look like:
/config/ ├── custom_components/ │ └── switchbot_meter_time_sync/ │ ├── __init__.py │ ├── button.py │ ├── config_flow.py │ ├── const.py │ ├── coordinator.py │ ├── manifest.json │ └── strings.json -
Restart Home Assistant
- Go to Settings → System → Restart
- Or use: Settings → Developer Tools → YAML → Restart
This integration will be available through HACS after community testing.
- Open HACS
- Click on Integrations
- Click the three dots in the top right
- Select "Custom repositories"
- Add this repository URL
- Select "Integration" as category
- Click "Add"
- Find "SwitchBot Meter Time Sync" and install
- After restart, go to Settings → Devices & Services
- You should see a notification about discovered SwitchBot devices
- Click Configure
- Confirm the device
- Done!
- Go to Settings → Devices & Services
- Click Add Integration (+ button)
- Search for "SwitchBot Meter Time Sync"
- Select your device from the dropdown
- Click Submit
If your device doesn't appear:
-
Press the Button
- Press and hold the button on your SwitchBot Meter for 2 seconds
- This puts it in pairing mode (Bluetooth icon appears on screen)
-
Check Bluetooth Logs
# Add to configuration.yaml logger: default: warning logs: homeassistant.components.bluetooth: debug
Restart HA and check logs for your device's MAC address
-
Use SwitchBot App (if needed)
- Open the app
- Tap your Meter device
- Settings → Device Info → BLE MAC
- Note the MAC address (format: XX:XX:XX:XX:XX:XX)
- Go to Settings → Devices & Services
- Find "SwitchBot Meter Time Sync"
- Click on it
- You should see your device listed
- Go to Settings → Devices & Services → SwitchBot Meter Time Sync
- Click on your device
- Find the "Sync Time" button entity
- Click it
- Check your SwitchBot Meter - the time should update within 5 seconds
- Edit your dashboard
- Add a new card (button type)
- Select the entity:
button.switchbot_meter_XXXXX_sync_time - Customize as desired
- Save
See the examples/automations.yaml file for examples.
Basic example:
automation:
- alias: "Daily SwitchBot Time Sync"
trigger:
- platform: time
at: "00:00:00"
action:
- service: button.press
target:
entity_id: button.switchbot_meter_XXXXX_sync_timeProblem: Integration doesn't appear in the Add Integration dialog
Solutions:
- Verify files are in correct location:
/config/custom_components/switchbot_meter_time_sync/ - Check file permissions (should be readable by HA user)
- Restart Home Assistant again
- Check logs for errors: Settings → System → Logs
- Enable debug logging:
logger: default: warning logs: custom_components.switchbot_meter_time_sync: debug
Problem: No devices appear in the device list
Solutions:
- Ensure device is powered on (check battery)
- Move device closer to Bluetooth adapter
- Put device in pairing mode (hold button for 2 seconds)
- Check Bluetooth integration is active
- Try manual entry with MAC address
Problem: Time sync button fails or times out
Solutions:
- Check Range: Move device closer to Bluetooth adapter
- Check Battery: Low battery can cause connection issues
- Check Interference:
- Disable other Bluetooth devices temporarily
- Move away from WiFi router
- Close SwitchBot App: Device can only connect to one client at a time
- Restart Bluetooth:
- Settings → Devices & Services → Bluetooth → Options → Restart
Problem: Button press succeeds but time doesn't change
Solutions:
- Wait 10-15 seconds after pressing (device may take time to update display)
- Check the response in logs for error codes
- Try pressing the physical button on the device (this should refresh display)
- Verify your Home Assistant time is correct
Problem: Only one device works when you have multiple Meters
Solutions:
- Add each device separately through the integration
- Ensure each has unique MAC address
- In automations, target each device specifically
- Consider adding delays between syncs if syncing multiple devices
If you have multiple Bluetooth adapters:
- Go to Settings → Devices & Services → Bluetooth
- Configure which adapter to use
- Set to "Active" mode for better connectivity
For faster connections, ensure:
- Bluetooth adapter is in Active mode
- Device is within 10-15 feet of adapter
- No physical obstructions (walls, metal objects)
- Minimal Bluetooth interference
To minimize battery impact:
- Sync once daily instead of multiple times
- Avoid rapid repeated syncs
- Use time-based triggers rather than state-based
If you need to remove the integration:
-
Remove Integration:
- Settings → Devices & Services
- Find "SwitchBot Meter Time Sync"
- Click three dots → Delete
-
Remove Files:
rm -rf /config/custom_components/switchbot_meter_time_sync
-
Restart Home Assistant
-
Clean Up (optional):
- Remove automation entries
- Remove dashboard cards
- Remove from configuration.yaml (if added)
If you encounter issues:
- Check Logs: Settings → System → Logs
- Enable Debug Logging: See troubleshooting section
- GitHub Issues: Report bugs with:
- Home Assistant version
- Integration version
- Device model
- Full error logs
- Steps to reproduce
- Set up an automation for automatic syncing
- Add the button to your dashboard
- Configure notifications (optional)
- Test with different sync schedules
Enjoy your automatically synced SwitchBot Meter!