mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
adding mqtt sleep time before doing disconnect
This commit is contained in:
@@ -105,6 +105,7 @@ Basically the same environment variables for the database, mqqt and timezone nee
|
||||
- **MQTT_USERNAME** string *(default: )*
|
||||
- **MQTT_PASSWORD** string *(default: )*
|
||||
- **MQTT_NAMESPACE** string *(default: )*
|
||||
- **MQTT_SLEEPTIME** integer *(default: 100)*
|
||||
|
||||
## API documentation
|
||||
|
||||
|
||||
@@ -450,8 +450,10 @@ func TeslaMateAPICarsStatusV1(c *gin.Context) {
|
||||
// run SubscribeMultiple on MQTTAllTopics map[string]byte
|
||||
m.SubscribeMultiple(MQTTAllTopics, nil)
|
||||
|
||||
// adding some short sleep before disconnecting
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
// getting sleep tim before disconnecting
|
||||
MQTTSleepTime := getEnvAsInt("MQTT_SLEEPTIME", 100)
|
||||
// adding some short sleep before disconnecting (based on MQTTSleepTimer)
|
||||
time.Sleep(time.Duration(MQTTSleepTime) * time.Millisecond)
|
||||
|
||||
// disconnecting from MQTT
|
||||
m.Disconnect(250)
|
||||
|
||||
Reference in New Issue
Block a user