Mqtt: use - to remove vehicle (#11192)
This commit is contained in:
parent
7f9d997bda
commit
e0d77dc865
2 changed files with 3 additions and 2 deletions
|
|
@ -129,7 +129,7 @@ func (m *Client) Publish(topic string, retained bool, payload interface{}) error
|
|||
return nil
|
||||
}
|
||||
|
||||
// Listen validates uniqueness and registers and attaches listener
|
||||
// Listen attaches listener to slice of listeners for given topic
|
||||
func (m *Client) Listen(topic string, callback func(string)) error {
|
||||
m.mux.Lock()
|
||||
m.listener[topic] = append(m.listener[topic], callback)
|
||||
|
|
|
|||
|
|
@ -287,7 +287,8 @@ func (m *MQTT) listenLoadpointSetters(topic string, site site.API, lp loadpoint.
|
|||
}
|
||||
if err == nil {
|
||||
err = m.Handler.ListenSetter(topic+"/vehicle", func(payload string) error {
|
||||
if payload == "" {
|
||||
// https://github.com/evcc-io/evcc/issues/11184 empty payload is swallowed by listener
|
||||
if payload == "-" {
|
||||
lp.SetVehicle(nil)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue