// SetMode sets loadpoint charge mode
SetMode sets loadpoint charge mode
// SetMode sets loadpoint charge mode
func (lp *LoadPoint) SetMode(mode api.ChargeMode) {
	lp.Lock()
	defer lp.Unlock()
	if _, err := api.ChargeModeString(mode.String()); err != nil {
		lp.log.WARN.Printf("invalid charge mode: %s", string(mode))
		return
	}
	lp.log.DEBUG.Printf("set charge mode: %s", string(mode))
	if lp.Mode != mode {
		lp.Mode = mode
		lp.publish("mode", mode)
		lp.elapsePVTimer()
		lp.requestUpdate()
	}
}
func ( lp * LoadPoint ) SetMode ( mode api . ChargeMode ) { lp . Lock ( ) defer lp . Unlock ( ) if _ , err := api . ChargeModeString ( mode . String ( ) ) ; err != nil { lp . log . WARN . Printf ( " " , string ( mode ) ) return } lp . log . DEBUG . Printf ( " " , string ( mode ) ) if lp . Mode != mode { lp . Mode = mode lp . publish ( " " , mode ) lp . elapsePVTimer ( ) lp . requestUpdate ( ) } }
SetMode sets loadpoint charge mode
SetMode sets loadpoint charge mode
// apply immediately // immediately allow pv mode activity